Hello, I am running into a probably abominably easy to fix VBA problem. I have NO idea how to code in VBA but I have been given a task to fix this piece of code that is broken and the VBA books I have will not tell me what I want to know nor can I find it online! So my apologies. Anyway.
Basically I have this enormous macro which is supposed to turn a Word doc into HTML. I'm running into problems when turning bookmarks into HTML anchors in a bunch of references/footnotes in the doc. the superscript in the text is linked down to wahtever its footnote is and at the end of the footnote there is a 'return to text' which links back to the superscript in question.
Problem is, when I select the superscript using Selection.Find and then replace that text as follows
Selection.Text = "<a href=" & dblQuote & hrefTemp & dblQuote & ">" & tempTextToDisplay & "</a>"
the bookmark that was associated with the superscript gets overwritten, so when I get down to the related 'Return to Text' to make the return anchor, the bookmark it refers to is gone and the whole thing craps out.
So things I would like to know:
1) How can I make it so that when I select, e.g. superscript 14 via Selection.Find it doesn't also select the surrounding bookmark?
2)How do I know what is the name of the bookmark that is associated with a selection (i.e. if I have selected superscript 14, how do I know that the bookmark surrounding it is named ref14)?
3) Likewise, how do I know what is the value of a the hyperlink that is associated with a selection? That is, if I have 'Return to text' selected, how do I know that it is hyperlinked to a bookmark name 'ref14'?
I am terribly frustrated.
Thanks!
Basically I have this enormous macro which is supposed to turn a Word doc into HTML. I'm running into problems when turning bookmarks into HTML anchors in a bunch of references/footnotes in the doc. the superscript in the text is linked down to wahtever its footnote is and at the end of the footnote there is a 'return to text' which links back to the superscript in question.
Problem is, when I select the superscript using Selection.Find and then replace that text as follows
Selection.Text = "<a href=" & dblQuote & hrefTemp & dblQuote & ">" & tempTextToDisplay & "</a>"
the bookmark that was associated with the superscript gets overwritten, so when I get down to the related 'Return to Text' to make the return anchor, the bookmark it refers to is gone and the whole thing craps out.
So things I would like to know:
1) How can I make it so that when I select, e.g. superscript 14 via Selection.Find it doesn't also select the surrounding bookmark?
2)How do I know what is the name of the bookmark that is associated with a selection (i.e. if I have selected superscript 14, how do I know that the bookmark surrounding it is named ref14)?
3) Likewise, how do I know what is the value of a the hyperlink that is associated with a selection? That is, if I have 'Return to text' selected, how do I know that it is hyperlinked to a bookmark name 'ref14'?
I am terribly frustrated.
Thanks!