Solved

Scripting Excel Automation Security

Posted on 2010-09-20
5
1,217 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
Comment Utility
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
Comment Utility
How do I look at my com/dcom security?
0
 

Author Comment

by:jnash67
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now