I'm having a VB6 application find (and subsequently replace) certain strings in a Word template, and I've now run into trouble when I'm trying to replace string in the footer. Evidently, the method I'm using only works for text in the main document and skips over the footer.
Doing it as follows:
With wrdWordApplication.Selection.Find
.ClearFormatting
.Text = strMyString
.Execute Forward:=True, Wrap:=Word.WdFindWrap.wdFindContinue
End With
Works fine to find any string in the main text but it never seems to search the footer. Oddly, if I record a macro in Word and do a find then (which presumably should get me the code equivalent to use), it does find the text in the footer, then when I review the code the macro recorder produce, it *is* the above.
I've been wandering around old topics here and on MDSN for most of the day trying to find alternative solutions but nothing seems to work so far. Might just be missing something obvious what with the heatwave we're having, and this being my first serious VB-to-Word work. Can anybody help me out here?
"Any fool can defend his or her mistakes; and most fools do." -- Dale Carnegie
Doing it as follows:
With wrdWordApplication.Selection.Find
.ClearFormatting
.Text = strMyString
.Execute Forward:=True, Wrap:=Word.WdFindWrap.wdFindContinue
End With
Works fine to find any string in the main text but it never seems to search the footer. Oddly, if I record a macro in Word and do a find then (which presumably should get me the code equivalent to use), it does find the text in the footer, then when I review the code the macro recorder produce, it *is* the above.
I've been wandering around old topics here and on MDSN for most of the day trying to find alternative solutions but nothing seems to work so far. Might just be missing something obvious what with the heatwave we're having, and this being my first serious VB-to-Word work. Can anybody help me out here?
"Any fool can defend his or her mistakes; and most fools do." -- Dale Carnegie