Tuesday, 4 July 2017

excel vba - Programmatically add VBA project references without VBE or VBIDE..?

This is a different twist to the old question about programmatically adding VBA project references: is there a way to programmatically add references, but...without VBE or an existing reference to VBIDE..?



Many Microsoft apps have the built-in application class VBE, with its own references collection: Application.VBE.ActiveVBProject.References. This includes Access, Excel, Word, PowerPoint, Visio, and probably many others. But some Microsoft apps don't have VBE, such as Outlook and Publisher. Plus, there are a variety of 3rd-party software packages with VBA, such as AutoCad and Corel Draw, but whether these have the VBE class is not known.




For those apps that don't have VBE, is there any fully-programmatic way to add a reference to VBIDE..? (assuming it's on the system)



I'm willing to entertain just about any idea except SendKeys. I've had thoughts of editing the document files at the character level. For instance, I'm sure if I drill down into the XML of an Excel file, I'd find the tags where the VBA references are stored. And for Access it would be SaveToText and LoadFromText, then dig through the text file. But for other apps, I know nothing or next to nothing of their file structures.

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...