Show a userform in a different workbook

davidkhbgh

New Member
Joined
Jan 2, 2006
Messages
40
I need to show a userform which is in workbook A from a button on workbook B

Code:
Workbooks("Tally Sheet ver7.2.xls").UserForm.ProductionData.Show

I thought this would work but it doesn't.

Thanks, Dave
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
1) in WB A, in the VBA editor, rename the VBAProject to something meaningful, in the Project Explorer Pane.
2) with WB A still open, in WB B, in the VBA editor, select Tools->References, and check off the entry for the VBAProject name of WB A
3)in a module in WB A, you should be able to type the VBAProject name of WB B, then a period, and a list of all of the VB Objects in the VBAProject should be visible... select the name of the userform, then type .Show

Caveat: whenever WB B gets opened, so will WB A... you cannot close WB A until WB B is closed, and WB A will not close automatically when WB B is closed, unless you add code to do so.

It's the only way I know to get it done... unless you copy the form to the other workbook...
 
Upvote 0
Here is another way without having to set any workbook cross references:

Add the following routine in a standard module in WBK A where UserForm1 is the name of the form.

Code:
Sub ShowForm()

    UserForm1.Show

End Sub

Then to load the form from WBK B, run the following routine in :

Code:
Sub LoadForm()

    Run "A" & "!ShowForm"

End Sub

Regards.
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,733
Members
448,987
Latest member
marion_davis

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