VBScript to change style of text
We are trying to change the format of the first letter of each word in a text input using this, working Word, VBscript
Sub ChangeStyleOfFirstLetterInWords()
Dim objWord As Range
For Each objWord In ActiveDocument.Words
objWord.Characters(1).Font.Size = 30
Next
End Sub
We converted this into the following that does work, but for some reason "objWord" is not an object and we can't access the first character, nor call methods on it.
(The below is just to test that objWord is initialised and can be assigned to Value). The goal is to convert only the first letter of each word
Dim objWord
For Each objWord In Split(Value)
Value = objWord
Next
This doesn't work
objWord.Characters(1).Font.Color = wdColorRed
Can anyone shine some light on how to convert our working VBScript code into code that is understood by Bartender VBScript?
-
Peter Thane
★ BarTender Hero ★
I think objword is a Word specific command for VB.
The only way I know of how to change the colour of an object by VB would to create a document level VB string but not sure how to do this for every word and not the full string.
There maybe another way of doing this. How many words will there be in the text input?
0
Please sign in to leave a comment.
Comments
1 comment