Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / May 2006

Tip: Looking for answers? Try searching our database.

Problems with starting word with /t switch

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BRC - 01 May 2006 20:11 GMT
I have a  word template that contains autonew macro and some other
code. If, in Word, I select File New and select this template the code
behind the New event for the document get's fired - however, if I
create a shortcut which starts Word with the /t switch, I get a new
blank document based on the template but none of the code is executed.
Also, it prompts me to save the both the new doc and template each
time.  Is anyone aware to a workaround for this? Thanks, BRC
Jean-Guy Marcil - 01 May 2006 22:07 GMT
BRC was telling us:
BRC nous racontait que :

> I have a  word template that contains autonew macro and some other
> code. If, in Word, I select File New and select this template the code
[quoted text clipped - 3 lines]
> Also, it prompts me to save the both the new doc and template each
> time.  Is anyone aware to a workaround for this? Thanks, BRC

This is because the Document_New event does not fire when Word first starts.
Try putting code in the Document_New event of the Normal.dot - when you
create a new document, it fires, but if you close Word and start it again,
it does not fire.

Test this with these in Normal.dot.

In the ThisDocument module:

'_______________________________________
Private Sub Document_New()

MsgBox "New!!!!!"

End Sub
'_______________________________________

and this one in a regular module:

'_______________________________________
Sub AutoExec()

MsgBox "AutoExec!!!!!"

End Sub
'_______________________________________

Create a new document before closing Word.
Then Close Word and start it again.

If you want to workaround your problem, put all your code in a regular
module and use something like I did above, but replace the MsgBox line by a
call to your sub in the regular module.

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.