Cush Posted June 13, 2006 Posted June 13, 2006 Hi, I'm using ExcelCOM to update a spreadsheet that has macros attached. I don't want to run the macro, I just want to get rid of the dialogue box that gices you the 'Disable Macros/Enable Macros/More Info' choices, as I want to stop the user being asked this. I don't want to reduce the security level as this will affect other spreadsheets, not just the one I'm interested in. Any ideas how I can resolve this? Cheers Paul
seandisanti Posted June 16, 2006 Posted June 16, 2006 Hi,I'm using ExcelCOM to update a spreadsheet that has macros attached. I don't want to run the macro, I just want to get rid of the dialogue box that gices you the 'Disable Macros/Enable Macros/More Info' choices, as I want to stop the user being asked this.I don't want to reduce the security level as this will affect other spreadsheets, not just the one I'm interested in.Any ideas how I can resolve this?CheersPaulyou can set the security level programmatically through COM, what i would suggest if you really want to make sure they're not asked, would be to set it to low, then open the workbook, then set it back to default after the sheet is open. so it only affects the security level in the time while the first page is being opened. i'll write up some code real quick.
seandisanti Posted June 16, 2006 Posted June 16, 2006 you can set the security level programmatically through COM, what i would suggest if you really want to make sure they're not asked, would be to set it to low, then open the workbook, then set it back to default after the sheet is open. so it only affects the security level in the time while the first page is being opened. i'll write up some code real quick.this snippet does exactly what i described. to test, change "book1.xls" to the full path and name of a workbook with macros, and give it a run. then open another book with macros (without closing the one opened programatically) and you will be prompted to enable/disable... $oEX = ObjCreate("excel.application") $oEX.AutomationSecurity = 1; 1 = allow, 2 = ask, 3 = deny $oEX.workbooks.open("book1.xls") $oEX.AutomationSecurity = 2 $oEX.visible = True
randallc Posted June 17, 2006 Posted June 17, 2006 (edited) Hi, I think the alternative he is asking for is simply to suppress the warning, rather than change the level; I have added that to ExcelCom now. [i have just opened another instance of excel for that specific purpose, and leave that open while processing other commands; revert when I complete each command. - Do you think that will work? (lets me run ExcelCom scripts on high level !)] Best, randall At Startup; $oxl=ObjCreate("Excel.Application") $oxl.DisplayAlerts = 0 $oxl.ScreenUpdating = 0 Edited June 17, 2006 by randallc ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW
seandisanti Posted June 17, 2006 Posted June 17, 2006 Hi, I think the alternative he is asking for is simply to suppress the warning, rather than change the level; I have added that to ExcelCom now. [i have just opened another instance of excel for that specific purpose, and leave that open while processing other commands; revert when I complete each command. - Do you think that will work? (lets me run ExcelCom scripts on high level !)] Best, randall At Startup; $oxl=ObjCreate("Excel.Application") $oxl.DisplayAlerts = 0 $oxl.ScreenUpdating = 0that actually will not work on every version of excel. at work i use office xp and that one has in the helpfile that the example i listed is the only way to do it (that's why i went that route), but i see on my home machine (with office 2k) right now that it doesn't have the same property, and setting the displayalerts to false does what he intends. so dependant on the version of excel, it has to be handled differently...
randallc Posted June 17, 2006 Posted June 17, 2006 (edited) interesting; it all works on Win XP PRO with Office 2003 for me; I see you mean "Office XP"'; I thought you meant "Win XP" at the office and Win2K at home... Sorry. I have never claimed ExcelCOM would work at all if not using Office 2003... I'm not bothering to support anything earlier. Best, Randall Randall Edited June 17, 2006 by randallc ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW
nugame Posted August 4, 2006 Posted August 4, 2006 I downloaded the ExcelCOM and finally started to try to use it. I have everything else automated and working. For some reason, I am getting this message when executing: C:\Program Files\AutoIt3\beta\Include\ExcelCom.au3 (474) : ==> "Case" statement with no matching "Select" statement.: I thought to download again incase I accidently corrupted the ExcelCOM.au3 file. I cannot find where to download. I see your samples but not the ExcelCOM file. Also, would I be wasting my time using this file fir Office XP? thanks. Dr SherlockAlways a way
Moderators SmOke_N Posted August 4, 2006 Moderators Posted August 4, 2006 I downloaded the ExcelCOM and finally started to try to use it. I have everything else automated and working. For some reason, I am getting this message when executing:C:\Program Files\AutoIt3\beta\Include\ExcelCom.au3 (474) : ==> "Case" statement with no matching "Select" statement.: I thought to download again incase I accidently corrupted the ExcelCOM.au3 file. I cannot find where to download. I see your samples but not the ExcelCOM file. Also, would I be wasting my time using this file fir Office XP? thanks.It's in the zip:http://www.autoitscript.com/forum/index.ph...st&id=10036 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
nugame Posted August 4, 2006 Posted August 4, 2006 Thanks for the link. it is in this list, just did not look well there. I replaced the ExcelCOM and now I get these errors: C:\PROGRA~1\AutoIt3\beta\Include\ExcelCom.au3(169,42) : ERROR: StringRegExp(): undefined function. If StringRegExp($s_i_Column, "[0-9]", 0) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\PROGRA~1\AutoIt3\beta\Include\ExcelCom.au3(171,67) : ERROR: StringRegExpReplace(): undefined function. $ColLettStart = StringRegExpReplace($s_i_Column, "[0-9]", "", 0) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Program Files\AutoIt3\testfiles\exceltest.au3 - 2 error(s), 0 warning(s) I search for this StringRegExp function in the autoit directory for other include files. What's missing? Dr SherlockAlways a way
randallc Posted August 4, 2006 Posted August 4, 2006 Just click "continue" in scite; its the error checking in scite that has been downgraded, nothing to do with autoit3 or excelcom Best, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now