I'm trying to devise a macro that will remove the double quotes around the insertion point in a document. The point I have got to so far is as follows:
Sub DeleteNearestDoubQuotes()
Application.ScreenUpdating = False
ActiveDocument.Bookmarks.Add Name:="LastPosition"
Selection.Find.ClearFormatting
With Selection.Find
.Text = """
.Replacement.Text = ""
.Forward = False
.MatchWildcards = False
.Wrap = wdFindStop
.Execute Replace:=wdReplaceOne
End With
With Selection.Find
.Text = """
.Forward = True
.Execute Replace:=wdReplaceOne
.Text = ""
End With
Selection.GoTo What:=wdGoToBookmark, Name:="LastPosition"
ActiveDocument.Bookmarks(Index:="LastPosition").Delete
Application.ScreenUpdating = True
End Sub
This actually worked the first time I tried it, but not subsequently. What I then discovered was the the code <.Text = """> automatically got changed in the VBA window to <.Text = """"> each time I tried to type it.
I'd had my doubts from the start that " (enclosed in " ") was acceptible in code for the quote character, and that I should instead be using the numbered character code for the quote characters (that would be left and right curly quotes?), but I don't know
the right way to do this.
Could some kind person put me on the right path?