View Single Post
 
Old 04-22-2014, 04:08 AM
Sorcerer13 Sorcerer13 is offline Windows Vista Office 2010 32bit
Novice
 
Join Date: Sep 2012
Location: God's Own County
Posts: 16
Sorcerer13 is on a distinguished road
Default VBA to identify how Word was invoked

Hi guys....

Does anyone know if it possible to identify how a Word Document (".docm"/".dotm") was opened from Explorer?

By that I mean if was opened by double clicking on it, or RMC and selecting "Open" from the options?

I'm interested in this because I tend to write a lot of VBA which is invoked by the User double clicking on the file, and then being presented with various options in order to create/complete various documents.
Normally the control is quite tight, so the User is constrained from accessing the VBA via Alt+F11.

When developing the code, I normally invoke it from something like "Sub Main_Process" via Alt+F11 and F5, and insert a commented out call to "Main_Process" in "Private Sub Document_Open()" or "Private Sub Document_New()" for templates.

When going into Production and uncommenting the call to Main_Process from "Private Sub Document_Open()" the User, and I can no longer access the VBA easily, which means I need to have a "Production" version and an "immediately prior to Production" version which I can get at to amend.

I just wondered if I could use the alternate method of opening the document (RMC & Open) to allows access to VBA by detecting it in the "Private Sub Document_Open()" code.

Any ideas, or am I barking up a blue herring?
Reply With Quote