Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Enable macro message on VBA Workbook Open then macro ends
I posted this in another thread, but I'm going to post a larger snippet of
code. Maybe someone can help. oldPath = File.Path If Not oldPath Like "Z:*" Then newPath = "http://myFolder/" & _ Right(oldPath, Len(oldPath) - 3) newPath = Replace(oldPath, "\", "/") End If Debug.Print newPath 'Opens workbook On Error Resume Next Set oWB = Nothing Debug.Print File.Name Set oWB = XLApp.Workbooks(File.Name) On Error GoTo 0 If oWB Is Nothing Then Set oWB = XLApp.Workbooks.Open(newPath, UpdateLinks:=False, ReadOnly:=True) 'Opens workbook, displays enable macro message, macro ends End If I have found that there is an issue with Workbook Open if the shift key is pressed, so that may explain some unexplained problems with macros stopping while I'm using communicator. I've played with application.AutomationSecurity to no avail. Has anyone seen this problem and identified a solution? I run macros like this all the time and I'm dead in the water if I can't get it working again. I'm using Office 2003, but Office 2007 is beginning to be deployed throughout the company. Thanks, Barb Reinhardt |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Enable macro message on VBA Workbook Open then macro ends
I have checked the Application.AutomationSecurity and have found this. The
numbers listed are the AutomationSecurity value on Debug.print. It appears that the initial security is SecuritybyUI. I'm not sure if that's the way it's supposed to be. Can someone confirm? Initial Security (when Excel is opened) 2 SecuritybyUI 2 SecurityForceDisable 3 SecurityLow 1 Thanks, Barb Reinhardt -- HTH, Barb Reinhardt "Barb Reinhardt" wrote: I posted this in another thread, but I'm going to post a larger snippet of code. Maybe someone can help. oldPath = File.Path If Not oldPath Like "Z:*" Then newPath = "http://myFolder/" & _ Right(oldPath, Len(oldPath) - 3) newPath = Replace(oldPath, "\", "/") End If Debug.Print newPath 'Opens workbook On Error Resume Next Set oWB = Nothing Debug.Print File.Name Set oWB = XLApp.Workbooks(File.Name) On Error GoTo 0 If oWB Is Nothing Then Set oWB = XLApp.Workbooks.Open(newPath, UpdateLinks:=False, ReadOnly:=True) 'Opens workbook, displays enable macro message, macro ends End If I have found that there is an issue with Workbook Open if the shift key is pressed, so that may explain some unexplained problems with macros stopping while I'm using communicator. I've played with application.AutomationSecurity to no avail. Has anyone seen this problem and identified a solution? I run macros like this all the time and I'm dead in the water if I can't get it working again. I'm using Office 2003, but Office 2007 is beginning to be deployed throughout the company. Thanks, Barb Reinhardt |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Enable macro message on VBA Workbook Open then macro ends
I've had to change the automation security to Low (whatever the setting is)
to get it work. Does anyone know why this would have changed overnight? Thanks, Barb Reinhardt "Barb Reinhardt" wrote: I posted this in another thread, but I'm going to post a larger snippet of code. Maybe someone can help. oldPath = File.Path If Not oldPath Like "Z:*" Then newPath = "http://myFolder/" & _ Right(oldPath, Len(oldPath) - 3) newPath = Replace(oldPath, "\", "/") End If Debug.Print newPath 'Opens workbook On Error Resume Next Set oWB = Nothing Debug.Print File.Name Set oWB = XLApp.Workbooks(File.Name) On Error GoTo 0 If oWB Is Nothing Then Set oWB = XLApp.Workbooks.Open(newPath, UpdateLinks:=False, ReadOnly:=True) 'Opens workbook, displays enable macro message, macro ends End If I have found that there is an issue with Workbook Open if the shift key is pressed, so that may explain some unexplained problems with macros stopping while I'm using communicator. I've played with application.AutomationSecurity to no avail. Has anyone seen this problem and identified a solution? I run macros like this all the time and I'm dead in the water if I can't get it working again. I'm using Office 2003, but Office 2007 is beginning to be deployed throughout the company. Thanks, Barb Reinhardt |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
macro to display message,when open workbook | Excel Discussion (Misc queries) | |||
Enable Macro message | Excel Worksheet Functions | |||
Macro ends early without error message | Excel Programming | |||
How can I enable my macro to only open for one particular workbook | Excel Programming | |||
Excel Enable Macro message | Excel Programming |