James Thomas
Posts: 5
Joined: 2015-09-11
|
I'm getting the error code
Words.Words cannot be indexed because it has no default property
When i try to execute the code below -
Dim Para As Word.Paragraph, rng As Word.Range, iLvl As Long
If Para.Range.Words(1) = "(" and Para.Range.Words(2) Like "[0-9]" and Para.Range.Words(3) = ")" Then rng.ParagraphFormat.Style = "STYLE1"
I'm converting from an old VBA Macro so apologies if this is obvious but I can't make this work.
The objective of the code is to check the first 3 characters of a line in word to see if they conform to a certain format and if so apply a style to the paragraph.
Any help greatly appreciated.
Thanks
James |
|
Andrei Smolin
Add-in Express team
Posts: 18825
Joined: 2006-05-11
|
Hello James,
Try replacing Words(index) with Words.Item(index).Text.
Andrei Smolin
Add-in Express Team Leader |
|