TimLitle
asked on
How do I programatically make "Microsoft Visual Basic for 5.3" a Word VBE Reference?
I thought the statement
VBE.ActiveVBProject.Refere nces.AddFr omFile ("C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6.DLL")
would do it but apparently not. What did I do wrong?
VBE.ActiveVBProject.Refere
would do it but apparently not. What did I do wrong?
Why would you want to do that? It should already be referenced.
ASKER
Your question is a good one because the statement should have been:
"VBE.ActiveVBProject.Refer ences.AddF romFile ("C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OL B")"
What I was trying to do is programmatically create a new .docm file, copy code modules to it, and because the copied code modules require it, I need to have the following Available Reference checked:
"Microsoft Visual Basic for Applications Extensibility 5.3"
For some reason, if I can't save a .docm file with Extensibility 5.3 checked and then open it with Extensibility still checked. However, if immediately after programitically opening the .docm file, I run the "VBE6EXT.OLB" statement, then copy code modules to it, then save it, the Extensibility 5.3 check survives.
I guess my only question at this point is why does the first sentence of the immediately above paragraph behave the way it does?
"VBE.ActiveVBProject.Refer
What I was trying to do is programmatically create a new .docm file, copy code modules to it, and because the copied code modules require it, I need to have the following Available Reference checked:
"Microsoft Visual Basic for Applications Extensibility 5.3"
For some reason, if I can't save a .docm file with Extensibility 5.3 checked and then open it with Extensibility still checked. However, if immediately after programitically opening the .docm file, I run the "VBE6EXT.OLB" statement, then copy code modules to it, then save it, the Extensibility 5.3 check survives.
I guess my only question at this point is why does the first sentence of the immediately above paragraph behave the way it does?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.