Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AutoOpen() doesn't fire - - opening Word doc from link

Status
Not open for further replies.

piedo

Programmer
Oct 21, 2002
2
CA
Does anyone have any suggestions on the following problem:

Coding for my company's intranet which is serving Word forms for our users to fill in. Within each form is a macro set up to fire when the document opens (using Public Sub AutoOpen(), which calls appropriate procedures for input boxes, etc.)

The code runs great when I open any of the documents locally (whether it's double clicing the file from Win Explorer, or doing a File, Open in Word).

Problem arises when I post the file to the server, and use the <a href....>

eg. <a href=&quot;path\filename.doc&quot;>LINK</a>

When the user clicks the link, Word opens, but the macro no longer fires. I've also attempted coding using the VB Document_Open(), but this doesn't work at all whether locally or linked.

Any suggestions?
 
Is this file opening with MS Word or IE? I've encountered issues when IE hosts other office docs. Also not sure if that is verbatim code, but the \ should be a /?
Also be sure the code is saved locally coupled to the -document- and not your personal projects Tranpkp
************************************
- Let me know if this helped/worked!
Please remember to give helpful posts the stars they deserve!
This facilitates the threads / posts for others! :)
 
Sorry about &quot;\&quot;; typo I missed. Have the correct syntax for the path for the link ... so that's not affecting things ...

Win2000 O.S. lets you uncheck &quot;Browse in same window&quot; for file types, so I've unchecked that for .doc files ...
So from IE, the file is opening in Word, but is it opening so that Word recognizes the auto events, etc. or do you think that Word still thinks it's opening in IE?

Also, when you say save the code locally, what exactly do you mean? The macros are saved in/with the file they're written for, is that what you're meaning (ie. not saved in the Projects macros?)



 
You may want to try moving the code from Auto_Open() to Document_Open() in ThisDocument.
 
Hai,

Opening a document thro a link will not open the AutoOpen macro bcoz ur not opening the document using the Word application. you r opening it thro http. So u need to download the document thro some ocx control and then open it in Javascript using Word Application object. Then only the autoOpen will fire.

karthik.
 
Basically - auto_open / document open events will only fire if Word is opened manually (same for any other M$ app) - you need to explicitly call the auto_open macro from the program you are using to open the app ie either in VBA for frontpage or in java (dunno whether that's possible but I'd assume so)
Rgds
~Geoff~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top