Enable macro message on VBA Workbook Open then macro ends

B

Barb Reinhardt

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
 
B

Barb Reinhardt

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
 
B

Barb Reinhardt

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top