ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto_Open - Prompt to Continue? (https://www.excelbanter.com/excel-programming/313480-auto_open-prompt-continue.html)

pkley[_2_]

Auto_Open - Prompt to Continue?
 
I have a Auto_Open macro that opens multiple workbooks. However, while I do
need it to run MOST of the time, I want an option to NOT run it.
Can I add code that will prompt "Would you like to Open Workbooks?", Yes
continues and No stops the macro...
Don't think you need it, but here's the macro now...
(Yes it's bloated, but each workbook is in a different child directory, and
I already had hyperlinks, so I just did a macro record)(I'm macro ignorant
too, can you tell?:-D)
Sub Auto_Open()
'
' Auto_Open Macro
' Macro recorded 10/13/2004 by Peter Kley
'

'
Range("O1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Windows("Payroll_Master_Entry_Concord_New.xls").Ac tivate
Sheets("GGD").Select
Range("O1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Windows("Payroll_Master_Entry_Concord_New.xls").Ac tivate
Sheets("JCF").Select
Range("O1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Windows("Payroll_Master_Entry_Concord_New.xls").Ac tivate
Sheets("MAK").Select
Range("O1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.ActivateNext
Sheets("PSB").Select
Range("O1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.ActivateNext
Sheets("RXA").Select
Range("N1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.ActivateNext
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets("TRA").Select
Range("N1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.ActivateNext
Sheets("TTT").Select
Range("N1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.ActivateNext
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("CEC").Select
Range("O1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.ActivateNext
Range("B277").Select
End Sub


Frank Kabel

Auto_Open - Prompt to Continue?
 
Hi
use the following type of code:

dim res
res=msgbox ("Continue",vbyesno)
if res<vbyes then exit sub
'your code


--
Regards
Frank Kabel
Frankfurt, Germany


pkley wrote:
I have a Auto_Open macro that opens multiple workbooks. However,
while I do need it to run MOST of the time, I want an option to NOT
run it.
Can I add code that will prompt "Would you like to Open Workbooks?",
Yes continues and No stops the macro...
Don't think you need it, but here's the macro now...
(Yes it's bloated, but each workbook is in a different child
directory, and I already had hyperlinks, so I just did a macro
record)(I'm macro ignorant too, can you tell?:-D)
Sub Auto_Open()
'
' Auto_Open Macro
' Macro recorded 10/13/2004 by Peter Kley
'

'
Range("O1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Windows("Payroll_Master_Entry_Concord_New.xls").Ac tivate
Sheets("GGD").Select
Range("O1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Windows("Payroll_Master_Entry_Concord_New.xls").Ac tivate
Sheets("JCF").Select
Range("O1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Windows("Payroll_Master_Entry_Concord_New.xls").Ac tivate
Sheets("MAK").Select
Range("O1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.ActivateNext
Sheets("PSB").Select
Range("O1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.ActivateNext
Sheets("RXA").Select
Range("N1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.ActivateNext
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets("TRA").Select
Range("N1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.ActivateNext
Sheets("TTT").Select
Range("N1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.ActivateNext
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("CEC").Select
Range("O1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.ActivateNext
Range("B277").Select
End Sub



pkley[_2_]

Auto_Open - Prompt to Continue?
 
Cool! It's even cleaner than what I found on the web...
Thanks!

"Frank Kabel" wrote:

Hi
use the following type of code:

dim res
res=msgbox ("Continue",vbyesno)
if res<vbyes then exit sub
'your code


--
Regards
Frank Kabel
Frankfurt, Germany


pkley wrote:
I have a Auto_Open macro that opens multiple workbooks. However,
while I do need it to run MOST of the time, I want an option to NOT
run it.
Can I add code that will prompt "Would you like to Open Workbooks?",
Yes continues and No stops the macro...
Don't think you need it, but here's the macro now...
(Yes it's bloated, but each workbook is in a different child
directory, and I already had hyperlinks, so I just did a macro
record)(I'm macro ignorant too, can you tell?:-D)
Sub Auto_Open()
'
' Auto_Open Macro
' Macro recorded 10/13/2004 by Peter Kley
'

'
Range("O1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Windows("Payroll_Master_Entry_Concord_New.xls").Ac tivate
Sheets("GGD").Select
Range("O1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Windows("Payroll_Master_Entry_Concord_New.xls").Ac tivate
Sheets("JCF").Select
Range("O1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Windows("Payroll_Master_Entry_Concord_New.xls").Ac tivate
Sheets("MAK").Select
Range("O1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.ActivateNext
Sheets("PSB").Select
Range("O1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.ActivateNext
Sheets("RXA").Select
Range("N1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.ActivateNext
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets("TRA").Select
Range("N1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.ActivateNext
Sheets("TTT").Select
Range("N1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.ActivateNext
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("CEC").Select
Range("O1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.ActivateNext
Range("B277").Select
End Sub





All times are GMT +1. The time now is 10:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com