• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1486
  • Last Modified:

Scripting Excel Automation Security

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
jnash67
Asked:
jnash67
  • 3
  • 2
1 Solution
 
GeneralTackettCommented:
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
 
jnash67Author Commented:
How do I look at my com/dcom security?
0
 
jnash67Author Commented:
If it's not instantiated, how can I accomplish the same thing (i.e. getting the scripts not to run)?
0
 
GeneralTackettCommented:
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
 
jnash67Author Commented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now