Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
I'm working in Word 2002 and have a macro that will run when the form is
open. The following coding works if the user opens the document in Word, however if they open it through Explorer, the macro does not run. Private Sub Document_Open() Dim Msg, Style, Title, Response Msg = "My message here." Title = "Shift + Tab Key Error" Response = MsgBox(Msg, Style, Title) End Sub Is there a way to get this to run whether the user opens the document in Word or Explorer? --- Jamie |
#2
![]() |
|||
|
|||
![]()
Hi Jamie
Is this code in a document or in a template? If it is in a template, bear in mind that the default action when you double-click a file name in Windows Explorer is not to open a template, but to create a new document based on that template. By contrast, the default action for a document, is to open the document. The way it's designed to work is as follows: 1. You create a template, and put the code in the template. Code in the Document_Open event will run whenever a document based on that template is opened. 2. Users fill in the form by doing File New and selecting your template. Or, they choose the template using Windows Explorer, and double-click the name of the template (which will create a new document based on the template). If you want code to run whenever anyone creates a new document from the template, use Private Sub Document_New(). Hope this helps. Shauna Kelly. Microsoft MVP. http://www.shaunakelly.com/word "Jamie" wrote in message ... I'm working in Word 2002 and have a macro that will run when the form is open. The following coding works if the user opens the document in Word, however if they open it through Explorer, the macro does not run. Private Sub Document_Open() Dim Msg, Style, Title, Response Msg = "My message here." Title = "Shift + Tab Key Error" Response = MsgBox(Msg, Style, Title) End Sub Is there a way to get this to run whether the user opens the document in Word or Explorer? --- Jamie |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How To Run Macro on Open | Microsoft Word Help | |||
can macro open file, print and close Word | New Users | |||
How do I use a macro to open a doc as text, without conversion | Microsoft Word Help | |||
Form Macro doesn't "stay" when others open the document | Microsoft Word Help | |||
2000 to 2002 macro and "Could not open macro storage" | Mailmerge |