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: David Wignall <email@hidden>
- Date: Sun, 13 Apr 2003 00:35:33 +1200
on 12/4/2003 11:17 PM, Oz.Springs at email@hidden wrote:
>
At 21:07 +1200 12/04/2003, David Wignall wrote:
>
> Bold and underline should have
>
> worked. I really did test before I sent, with Script Editor 1.9 and Word X.
>
> Did anything happen at all?
>
I'm sorry, but your script did nothing to change either document. Using Word
>
X.
>
>
I put your script into Script Editor as is, the same as I did the other
>
scripts. Was I supposed to do something else?
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
"Perhaps the truth is less interesting than the facts?"
Amy Weiss,
The RIAA's Senior Vice President of Communications
Email to The Register
_______________________________________________
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.