EXCEL for MAC: Event Macro to Open 2 workbooks at same time

KerryFSA

New Member
Joined
Dec 5, 2018
Messages
49
The macro below is copied from a Windows VBA tutorial.

Doesn't work on my Mac.
Can anyone sort out the syntax problem?
It should open a dialogue box to locate the file that should be opened.
I want to open a second workbook when a first WB is opened.
Thanks.



Sub Open_Workbook_Dialogue()

Dim wb As Variant

wb = Application.GetOpenFilename(FileFilter:=”Excel Files,*.xl*;*.xm*”)
If wb <> False Then
Workbooks.Open FileName:=wb
End If

End Sub
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Upvote 0
I am not up-to-date on all the differences between Excel for PC vs Excel for Mac, but if the event procedures are the same, there is no "Open_Workbook_Dialogue()" event procedure, just "Workbook_Open".

Hi Joe,
Thanks very much. I already use (successfully) the Open workbook routine. If there is no such thing as
Sub Open_Workbook_Dialogue(), I'll just place code and a dialogue box within the one I'm already using.
Kerry
 
Upvote 0
Thanks very much. I already use (successfully) the Open workbook routine. If there is no such thing as
Sub Open_Workbook_Dialogue(), I'll just place code and a dialogue box within the one I'm already using.

Yes, that is what you want to do.
By the way, where did Open_Workbook_Dialogue come from? Did you see it used somewhere?
 
Upvote 0
It was some time ago and i don't remember from whence it came.
I was just curious, because I have never seen it, and a Google search returned nothing.
Excel Event Procedures (code that runs automatically upon some event happening) and VERY specific and must be named exactly a certain way (they are all pre-defined), so you cannot choose your own name for them.

Perhaps someone had create some code and named it that, in which case, it would NOT be an event procedure, and not would automatically run. However, it could be called by an event procedure (i.e. maybe they called it from a Workbook_Open event).
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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