Hi All,
I have an Excel routine that populates a Word template by searching codes and replacing them with the relevant text. This is working fine.
Embedded within the replacement text, I have additional codes that relate to footnotes - the Excel tool can correctly identify these codes, look up the relevant footnote text and add a new footnote with the correct reference and text. All good.
What I cannot get it to successfully do is place the footnote at the correct location in the body of the Word document. Currently, my best solution is as follows:
The problem is in correctly defining the location of the SearchCode within the body of the document - using the InStr() function doesn't work because this picks up all the nonprintable characters in the document, so the character count is never correct.![]()
Please Login or Register to view this content.
Any suggestions for how to get around this? Perhaps one of the following:
- Is there some way of me defining Rge in terms of an output from the .Find function?
- Alternatively, can I replace the SearchCode directly with the footnote?
- Or, instead, is there a simple way of identifying the accurate character count / insertion point for the replaced text?
Many thanks in advance,
AL
Bookmarks