Re: Making text plain or bold in Word
Re: Making text plain or bold in Word
- Subject: Re: Making text plain or bold in Word
- From: "Oz.Springs" <email@hidden>
- Date: Sat, 12 Apr 2003 13:58:39 +0100
At 0:35 +1200 13/04/2003, David Wignall wrote:
>
>
Just to be sure, here is the script in it's entirety
>
>
tell application "Microsoft Word"
>
do Visual Basic "
>
Dim rngWord As Range
>
Dim i As Integer
>
With ActiveDocument
>
With .Range
>
With .Font
>
.Bold = False
>
.Italic = False
>
.Underline = wdUnderlineNone ' and so forth
>
End With
>
With .ParagraphFormat
>
.Alignment = wdAlignParagraphLeft ' and more
>
End With
>
End With
>
For Each rngWord In .Words
>
With rngWord
>
If .Text <> vbTab Then
>
If .Text <> vbNewLine Then
>
rngWord.Font.Bold = True
>
i = i + 1
>
End If
>
End If
>
End With
>
If i = 2 Then Exit For
>
Next rngWord
>
End With
>
"
>
end tell
>
>
This should remove any bolding, italicisation or underlining in a Word
>
document and set the paragraph alignment to left before bolding the first
>
two words. This script is straight out of a Smile text window and works in
>
Word X OMM. I tested on a variety of different documents and discovered a
>
flaw: a parenthesis is considered a word. Ah, well 80:20 strikes again.
>
>
--
>
Dave
It works, but (just to be picky) the email links remained blue and the link stayed there... The blue colour on the link is a character style called "hyperlink". In fact all the styles remain; your script just overwrites them, does not remove them, just as Shane's did (intermittently).
My script and Paul's change everything to "Normal" including the character styles. So far as I am aware you cannot get rid of Normal which is the basis of all text in Word but you should be able to get rid of all the other styles if you want to strictly meet the requirement for "plain text" which is what Frank asked for.
In a very old version of Word on a DOS PC (1980s), Normal was always Courier. You could change the font and other attributes in the Normal template, but as soon as you rebooted, Courier would come back for the template would always default to Microsoft's preordained setup.
Kind regards
Oz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.