Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Scripting Excel Automation Security

Posted on 2010-09-20
5
Medium Priority
?
1,440 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

618 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