Enable/Disable macro dialog

D

DapperDanH

Hello,
Is there a way to open up a office file and disable macros from running,
independent of the current security settings?

Here is a quick description of the application:

1. User lists a series of msproject file paths.
2. User hits Publish
3. Using COM, the application loads each file one at a time, querying
information contained in the file.

The problem is files that contain macros and the enable/disable dialog that
automatically pops up. The dialog will lock the server. Typcially, I am
running the application as a server with visible=false, so the user never
sees this dialog.

For this application, I do not need the macros within the files. Is there a
way to load the file without macros so the dialog does not show? Is there a
way to query the office application to see what security setting it is set at?

Thanks,
Dan
 
D

DapperDanH

The files are loaded using Application.FileOpen through code. Unfortunately,
holding shift does not solve the problem.
 
T

Tushar Mehta

Don't know about MSProject, but as far as Excel goes -- and I believe
the same applies to other Office apps such as Word and PowerPoint --
the default action when a file is opened programmatically is to enable
macros.

XL does provide the ability to change the default behavior through the
Application's AutomationSecurity property. Maybe, MS Project has
something similar.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 
W

Wei-Dong XU [MSFT]

Hi Dan,

I don't know whether your macro code in the mpp files are written in the
open event handler. If so, at the arguments of FileOpen method, you can set
the "NoAuto" to true so that Auto_Open macro is prevented from running.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/pjsdk/html/
pjmthfileopen.asp

Another suggestion is that you can set the project applicaton security at
your code runtime so that the macro will be disable. At the processing of
these files, you can switch back the seucirty setting to the default one.
In this way, since the security can only be affected at the runtime of your
application, other user in the box should not be affected.
This kb article introduces more information for you:
317405 How to implement the Application.AutomationSecurity property in
Office XP
http://support.microsoft.com/?id=317405

Please feel free to let me know if you have any question.

Best Regards,
Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
D

DapperDanH

Tushar and Wei, Thanks!!!
Application.AutomationSecurity solved my issue.

Sincerely,
Dan
 
W

Wei-Dong XU [MSFT]

Great news!

You are welcome! :0)

Best Regards,
Wei-Dong XU (WD)
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Z

ziggy

Hi Xu,

I can't find zipcodeweatherreport.xls in Microsoft Office XP Web
Services Toolkit 2.0.
Where can download the offwstk.exe which has the
zipcodeweatherreport.xls?
Based on the article I read
http://www.microsoft.com/china/msdn/archives/library/dnxpwst2/html/odc_wsrxl.asp
It has a link to this file, but the link is not working at all.

Can you help me with that? because I am going to consume the web
service soon and need an example to look at it.

Thanks in advance

Ziggy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top