View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default 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