Puase macro to allow user to open/activate a WB, continue

TTom

Well-known Member
Joined
Jan 19, 2005
Messages
518
I can't quite figure out code needed to pause a proceedure, allow user to activate a sheet in another workbook,
may involve opening it first, then let proceedure continue.

Best would be a message prompt:
"Please open/select as active your personal workbook now."
"Select OK once you've done this."

Selecting 'OK' button would allow the proceedure to continue.
Cancel would goto error handler I can write.

MsgBox doesn't allow other task until after OK is selected... :confused:
Thanks, TTom
 
Tom

I would need to see the code you have for checking if a workbook is open to tell you how to incorporate my suggested code into it.

There are different 'flavours' of that type of code.

I know at least 2, one uses error handling, the other a loop.

As to allowing the user to select an already open workbook, for that I would suggest creating a userform which lists all currently open workbooks for the user to select.

It could also have an option allowing the user to opt to open a new workbook.
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
As to is open check code, how about this:

Dim strFileName As String, wbEnum As Workbook, blnIsOpen As Boolean
'strFileName = "Path with wb name" (i.e. "C:\UserPath\UserWb.xls") or Variable (i.e. wbPers?)

For Each wbEnum In Excel.Workbooks
If LCase(wbEnum.Path & "\" & wbEnum.Name) = LCase(strFileName) Then blnIsOpen = True: Exit For
Next

If blnIsOpen = False Then 'Workbook isn't open
Workbooks.Open strFileName
End If


On other option using my yes/no query ...
So, there is no easy way to simply pause the macro while user activates their already open workbook, then hit an okay button to continue (my original thought.) IN the end it may KISS solution to request user does not open other WB until they begin macro?
 
Upvote 0

Forum statistics

Threads
1,216,175
Messages
6,129,310
Members
449,499
Latest member
HockeyBoi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top