none
Including an optional whole word in Find RRS feed

  • Question

  • I'm writing a macro to find a listing of objects in a word document.  Using find with wildcards I can find all instances of the objects using the following search string

    "Object[ s\-"and",0-9]{2,}".  However, when attempting to use this search string within my macro using Selection.Find.Execute(FindText:="Object[ s\-"and",0-9]{2,}") I get an error.  I know it is because of the quotes around "and" in the FindText.

    How can I include the whole word "and" in FindText string without getting an error?

    Thank you for all of your help!

    Wednesday, March 6, 2013 12:35 PM

Answers

  • Double the quotes within the quoted string:

    FindText:="Object[ s\-""and"",0-9]{2,}"


    Regards, Hans Vogelaar

    • Marked as answer by Grant_S Wednesday, March 6, 2013 1:15 PM
    Wednesday, March 6, 2013 12:44 PM