Solved

Scripting Excel Automation Security

Posted on 2010-09-20
5
1,282 Views
Last Modified: 2012-05-10
In Excel VBA doing the following

    Application.AutomationSecurity = msoAutomationSecurityForceDisable
    Call Application.Workbooks.Open("c:\temp\book1.xls", False, True)
    Application.AutomationSecurity = msoAutomationSecurityLow

Open in new window


works well for opening the file and disabling the running of any code.

When I do the exact same thing from a scripting language (I'm using AutoIt) I get a COM error trying to set AutomationSecurity.   The Workbooks.Open works fine.  Setting anything else in the Excel object also seems to work fine -- application.visible, application.caption, application.quit etc.

Is there a way around this, or else to otherwise open a file without triggering code?
0
Comment
Question by:jnash67
  • 3
  • 2
5 Comments
 
LVL 8

Expert Comment

by:GeneralTackett
ID: 33721244
likely that automation security is not instantiated.  if you are doing this from another scripting language and not vba.  Also you should look at your com/dcom security..
0
 

Author Comment

by:jnash67
ID: 33724707
How do I look at my com/dcom security?
0
 

Author Comment

by:jnash67
ID: 33725937
If it's not instantiated, how can I accomplish the same thing (i.e. getting the scripts not to run)?
0
 
LVL 8

Expert Comment

by:GeneralTackett
ID: 33746207
start > run > dcomcnfg

this will get you there... but without knowing your system I cant help much more about this topic

also make sure the com/dcom object is registered
regsvr32 <name of dll/exe that is the com/dcom object>  

instantiated means some program creates the object instance.. but you said "not to run"  not sure what that means..
0
 

Accepted Solution

by:
jnash67 earned 0 total points
ID: 33778931
To close this item out, the

    Application.AutomationSecurity = msoAutomationSecurityForceDisable

works and the workbook opens without running any macros automatically.  However, once set, I couldn't figure out how to unset it so I could then run macros later.

    Application.AutomationSecurity = msoAutomationSecurityLow

Didn't work to re-enable things so that macros could be run.  I ended up having to re-architect things so there were no startup macros.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

828 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