Solved

Scripting Excel Automation Security

Posted on 2010-09-20
5
1,254 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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
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.

773 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