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

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

hatman

Well-known Member
Joined
Apr 8, 2005
Messages
2,664
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...
 

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
8,253
Office Version
  1. 2016
Platform
  1. Windows
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.
 

Forum statistics

Threads
1,136,878
Messages
5,678,320
Members
419,755
Latest member
eshnider21

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
Top