forum

Home / DeveloperSection / Forums / find and replace symbol using vbs

find and replace symbol using vbs

Jayden Bell282520-Jun-2013
Hi Expert,

I am working a 1XXX words documents, I want to use vbs to changing the status of checkbox faster but I can't found any work solution, after that, i wonder if find and replace can solve my issue, so i wrote some code for this

Const wdReplaceAll  = 2

Set objWord = CreateObject("Word.Application")
objWord.Visible = True

Set objDoc = objWord.Documents.Open("C:\checkbox.doc")
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection

objSelection.Find.Text = "@1"
objSelection.Find.Forward = TRUE
objSelection.Find.MatchWholeWord = TRUE

objSelection.Find.Replacement.Text = objSelection.InsertSymbol 253, "Wingdings"
objSelection.Find.Execute ,,,,,,,,,,wdReplaceAll
But, it can't work, and always show the error on the objSelection.InsertSymbol 253, can anyone advice me how to do it A.S.A.P?


Any help on above is really appreciated.

Updated on 20-Jun-2013

Can you answer this question?


Answer

1 Answers

Liked By