Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 Word Macro Doesnt Run When opened...

Author  Topic 

jhermiz

3564 Posts

Posted - 2005-04-20 : 10:44:36
A link on a page:
file://blah

opens a word document. The word document has an on open event:


Private Sub Document_Open()
ActiveWindow.DocumentMap = True
End Sub


VERY very simple code to just show the document map in word. If I open the document directly without being on the web page the macro runs. If I click the link to open file://blah on the web page the word document opens up fine, the only problem is the dang document map doesnt show. Even with the open event in the word document the macro still doesnt run.

Anyone with ideas on how to ensure that the document map opens?

Jon



Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2005-04-20 : 20:07:38
It's not running as a security measure. Your machine won't run code that comes from a remote source (i.e. your intranet site that contains the link to the document).

Adding the site url to your trusted zone in IE might help it, but essentially you can not ensure the macro will run for all users. Can you imagine how much more trouble we would be in if this was the case ?



Damian
Ita erat quando hic adveni.
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-04-21 : 09:36:09
But is there any way at all to keep the document map open at all times for these specific documents.

Thanks


Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-04-21 : 18:58:05
Not through IE. You'll have to force it to open the document in Word.
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2005-04-21 : 19:00:01
quote:
Originally posted by robvolk

Not through IE. You'll have to force it to open the document in Word.

You mean with that "attachment" HTTP header option we were talking about over in the Reporting Services forum?

---------------------------
EmeraldCityDomains.com
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-04-22 : 08:31:40
Rob the thing is...check this out

If you go to:
'My Computer'
Then select tools
Then select folder options
Click the tab labeled 'file types'
Highlight the extension type '.DOC' Microsoft Word Document.
Click the advanced tab.
Then uncheck the checkbox 'Browse in same window' (btw you can do this for your problem AjarnMark regarding the pdf's but the problem is you have to do this on the client machine (All of them)).

So now I have set it to open word on its own...but even in that case..if I click the link it goes to file://blah/blah.doc
and it opens it up in word but the document map does not appear. Even with the on open event macro. If I open the file up directly through windows explorer the document map opens up correctly.

Any other suggestions ???



Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2005-04-22 : 16:24:24
Hmmm... this is strange. I thought I'd check it out and see if it really did solve our RS to PDF issue, but when I went there, the option was grayed out (disabled). Weird.

---------------------------
EmeraldCityDomains.com
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-04-22 : 16:25:40
For pdf documents ? Do you have admin rights to your local machine ?


Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-04-22 : 18:30:56
I should have been more clear. When you open it via Windows Explorer, the .DOC is associated with MS Word, and it will open it normally via the Word executable (therefore running the macro).

IE will open MS Office documents embedded within its own application space, and will NOT run autoexec macros. It will still look and feel like MS Word, but it is not actually running the Word application. I believe what IE is doing is instantiating Word via ActiveX, not through the EXE application.

You can confirm this by comparing the toolbars that display in Word and IE. If the normal Word toolbars do not appear when you open the document, then it's not running Word.EXE and will therefore not run the macros.
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-04-23 : 13:38:43
quote:
Originally posted by robvolk

I should have been more clear. When you open it via Windows Explorer, the .DOC is associated with MS Word, and it will open it normally via the Word executable (therefore running the macro).

IE will open MS Office documents embedded within its own application space, and will NOT run autoexec macros. It will still look and feel like MS Word, but it is not actually running the Word application. I believe what IE is doing is instantiating Word via ActiveX, not through the EXE application.

You can confirm this by comparing the toolbars that display in Word and IE. If the normal Word toolbars do not appear when you open the document, then it's not running Word.EXE and will therefore not run the macros.



Understandable...however, did you try what I posted ? Because if I do open it from IE I do notice there is only one toolbar loaded which you have stated. However when I set it up using those options that I talked about above it really really does look like it is using the WORD exe..maybe I am wrong but all the standard toolbars are there when you set those options.


Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page
   

- Advertisement -