Home |
Search |
Today's Posts |
#14
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
aditel submitted this idea :
I found out what was reason of the problem with error 1004. It was security level of macros that by default is set to "Disable all macros with notification". So when workbook was opened and code was running, it was not possible to get to VBProject object when macros in the workbook are not enabled. Solution for that is to read value of AutomationSecurity, then change it to Low level, open workbook, do necessary actions, close workbook and finally back to origional AutomationSecurity setting before file was opened. SecurityLevel = Application.AutomationSecurity Application.AutomationSecurity = msoAutomationSecurityLow ... code lines ... Application.AutomationSecurity = SecurityLevel This suggests that this property was altered (by code at some point) as the default Excel setting is 'msoAutomationSecurityLow' and works fine regardless of what UI security settings are in place. Note that automated instances of Excel have no security settings at all. I suspect this is the reason why the AutomatedSecurity default is 'msoAutomationSecurityLow'. -- Garry Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Run-time error 1004 Method SaveAS of object _Workbook failed | Excel Programming | |||
method 'SaveAs' of object '_Workbook' failed | Excel Programming | |||
Method 'CheckIn' of object '_workbook' failed | Excel Programming | |||
Error 1004 Method 'Add'of Object Sheets failed | Excel Programming | |||
Error 1004: Method 'Cells' of object '_Global' failed | Excel Programming |