PDA

View Full Version : [SOLVED:] Issue with References



jwise
09-14-2018, 09:04 AM
This is complicated to explain. I hope I do a good job.

My macro code reads a worksheet and invokes Word. Word loads a template which has several (a dozen or so) bookmarks. Each of these bookmarks are place-holders where a value from the row I'm working on will be placed. After all the values are placed, the bookmarks are deleted. The now-completed form is printed and I move to the next row.

I originally worked on this using Office 2010. After making extensive changes, I moved this code to another machine which had Office 2016 and finished the development. Once completed, I moved the code back to the original PC.Now when I try to run it, VBA gets upset with my general purpose routine which deletes the bookmarks. It brings up the References dialog and points out that I'm missing Word version 16. I uncheck this reference, find the Word 14.0 reference and check it. I save the file and exit Excel. When I start it up, it does the exact same thing. I can't change the reference from Word 16 to 14. My selection of a reference to Word 14 is lost.

Also, these references are a long way apart. I'm guessing there is some magic keystroke which will move a reference to the top without two or three minutes of clicking on the priority control. I couldn't find this with a search.

Here is the code VBA always points to when I start up a macro:


Sub delBookMark(wordApp As Word.Application)
'
' Code adapted from Budget system
'
Dim objBookmark As Bookmark

For Each objBookmark In wordApp.ActiveDocument.Bookmarks
objBookmark.Delete
Next

Set objBookmark = Nothing

End Sub

Thanks for looking.

jwise
09-18-2018, 03:26 PM
The problem is now solved, perhaps a better word is circumvented.

Apparently the changes I made to the References were discarded because my macro options were incorrect. I don't know how that happened because the Excel file has been around a long time and I have written several dozen macros in this file. Perhaps it had something to do with transferring the file between different PCs with different OSes and levels of Office. Note that my lack of authority was not conveyed to me. I had no clue the changes weren't accepted.