Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to display message,when open workbook puiuluipui Excel Discussion (Misc queries) 7 October 13th 09 12:39 PM
Enable Macro message ub Excel Worksheet Functions 2 August 8th 08 03:37 PM
Macro ends early without error message Richard J. Snee Excel Programming 3 January 29th 08 06:56 PM
How can I enable my macro to only open for one particular workbook Neale Yonde Excel Programming 2 August 6th 07 10:36 AM
Excel Enable Macro message Worsty Excel Programming 3 March 4th 04 03:41 AM


All times are GMT +1. The time now is 12:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"