?
Solved

Enable Word Macros

Posted on 2005-03-15
15
Medium Priority
?
257 Views
Last Modified: 2008-01-16
I just have a simple question, I need to double check this issue before I make it a closed case.  But here is the situation, we have a group of word templates that need to be added to our intranet for employee's to access, The templates have macros in them and they need to run when the template opens.  If I place this template on my asp page and try to open it from there, the macro is disabled and won't run.  Is there any code I can add in order to force the macro to run properly.
0
Comment
Question by:Justin Imes
  • 8
  • 6
14 Comments
 
LVL 20

Expert Comment

by:dsacker
ID: 13545414
A few things you can do that may not be directly Word-related, but may help:

1. Add your website to your list of trusted sites.
2. If your website is on the inTRAnet, lower the security level.
3. If you have in-house digital signatures, set up a certificate for your app (it's really not hard to do ... start with office/selfcert.exe).

Hope this helps.
0
 
LVL 9

Author Comment

by:Justin Imes
ID: 13545530
I tried what you suggested, still not working, I don't think its a security issue, I think I need to force ASP to run the macro, I have all my security level's set to low (just for testing)
0
 
LVL 20

Expert Comment

by:dsacker
ID: 13546602
If your macro is running automatically when you open your Word document, then you've already coded the open event. If you've been having to invoke the macro yourself, then you probably need to code for the open event.

Do you have something like the following in your ThisDocument VBA Editor?

Option Explicit
Private Sub Document_Open()
    Call SomeRoutine
End Sub

Also, on your Word document itself, do you have Tools, Macro, Security, Trusted Sources checkboxes turned on for both installed add-ins/templates AND access to Visual Basic Project?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Author Comment

by:Justin Imes
ID: 13546737
Hmm okay i have to try that code you provided me.

The macro will open and run perfectly in the web folder, but when I create a link to it and click open, the macro tries to run and open, sometimes, only sometimes though i will get the "disable/enable/more info" dialogue box, if i click enable.... my template will display but minus the information the macro was suppose to input.  Also when i click enable it will open up another word window but it will be blank, so i think what is happening is that when you click enable macro, it brings up a new window trying to run the macro, but for some reason the macro does not run.  does that make sense?
0
 
LVL 20

Accepted Solution

by:
dsacker earned 200 total points
ID: 13547484
Yes I think I do. You're opening the Word documents in Internet Explorer, not in MS Word itself. In essence, to achieve what you're wanting, you'd have to do the equivalent of having your end user download the document and open it locally, hence in his instance of MS Word.

Does that make sense? :)

I really think your best options will be to either:

1.  Allow them to RIGHT-CLICK on your templates link, and have them "Save As" to their local machine.

Or.

2.  Have the templates on the LAN somewhere as read-only, bypass the inTRAnet altogether, and have them open them via mapping a drive letter to that folder.
0
 
LVL 9

Author Comment

by:Justin Imes
ID: 13547569
actually those were my two "outs" if you guys couldn't help me, I just thought i was missing something.
so you think there is no way to make this happen via our intranet browser.

But thats exactly the two options I told them they had if EE couldn't give me a hand. :)
0
 
LVL 20

Expert Comment

by:dsacker
ID: 13547919
You could start an instance of MS Word via a VBSCRIPT, but you will probably still need a LAN drive mapped to everyone, because the VBSCRIPT will run as if locally (actually, no "as if" about it ... it will run purely local).

Here's an example of its simplest form. Try it. :)

<html>
<head><title>Open Word Document</title></head>
<body>
<script language=vbscript>
Sub Open_Word(strFile)
    Dim objWord

    Set objWord = CreateObject("Word.Application")
    objWord.Visible = True
    objWord.Documents.Open strFile
    Set objWord = Nothing
End Sub
</script>
<p>Enter the Word document and press the command button to open it.</p>
<input type=file name=worddoc size=40>
<input type=button value="Open Document" name=openword onclick="Open_Word(worddoc.value)">
</body>
</html>
0
 
LVL 9

Author Comment

by:Justin Imes
ID: 13548388
actually, thats didn't work either, same result.  The macros didn't run.

But thats a very nice and simple form.

I think my only option is to let our users know they can not just Open the document, they need to either save as or access through the network (mapped drive)
0
 
LVL 20

Expert Comment

by:dsacker
ID: 13548554
You could add a line after you open the objWord, such as:

    objWord.Run MyMacro, MyParameter

After that, I'm about at the end of my suggestions. :)
0
 
LVL 9

Author Comment

by:Justin Imes
ID: 13555288
Hmm that also doesn't seem to be working, I think I am just going to purpose the two ideas we posted up earlier.
0
 
LVL 9

Author Comment

by:Justin Imes
ID: 13568103
Thanks for your help, the points are yours for backing up my thoughts.
0
 
LVL 20

Expert Comment

by:dsacker
ID: 13568349
You're welcome.

I'm a little surprised that for the extent of my help, you'd only grade this as a "B", especially considering you only spent 50 points on the question.

You certainly got a 2nd-mile contribution on my part. Your disappointment in a solution that is not exactly what you wanted should not penalize someone's effort in researching the best possible solutions that were available.
0
 
LVL 9

Author Comment

by:Justin Imes
ID: 13568551
I apologize, you certainly did help me, is there a way to change the grade i have given? I was in a hurry and didn't put much thought into it, if it concerns you, I will change it, you do deserve it for the effort.
0
 
LVL 9

Author Comment

by:Justin Imes
ID: 13569213
Thank You.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question