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.
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.