Tuesday, January 16, 2018

#1 2003-04-13 11:04:57 am

Ray Barber
Site Admin
From:: Lake Dallas, Texas
Registered: 2002-11-20
Posts: 348
Website

Word X formatting removal

An example of one way to remove bold and italicized text from the active Word document. From the AppleScript Users List.

OS version: OS X

Applescript:

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


Ray Barber
Admin | MacScripter


Filed under: microsoft

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)