I am having an error when compiling VBScript that will delete a specific line in RTF file. The error points to Line 6, Char 25 which is '=' sign in "Selection.GoTo What:=wdGoToBookmark" statement but I think the syntax is correct.
Error Message
Line: 6 Char: 25
Error: Expected statement
Code: 800A0400
Source: Microsoft VBScript compilation error
Set Word = CreateObject("Word.Application")
Set wordfile = Word.Documents.Open("filename.RTF")
Word.Visible = TRUE
Sub Macro1()
Selection.GoTo What:=wdGoToBookmark, Name:="IDX12"
With ActiveDocument.Bookmarks
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
Selection.MoveUp Unit:=wdLine, Count:=2
Selection.Delete Unit:=wdCharacter, Count:=1
ActiveDocument.Save
End Sub
Macro1
Word.Quit