Reference Object on User Form in separate Workbook

Maryz

Board Regular
Joined
Dec 10, 2002
Messages
197
I know how to run a macro that resides in a module in another workbook.

Application.Run "'MacroSource.xls'!Macro1"

What I would like to do is control an object that resides on a user form in another workbook and I’m having problems with the statement. For example, I like to have a user press a command button on UserForm1 which resides in Book1.xls and change the caption on Label1 of the same form with Macro1 from a module of another book called MacroSource.xls. The statement above will allow me to execute Macro1 from Book1.xls. Where I need help is the Macro1 procedure.

Sub Macro1()
Book1.xls UserForm1.Label1 = "Hello"
End Sub

How do I properly combine the above statement to control Label1 on UserForm1 in Book1.xls from Macro1 which resides in a module in MacroSource.xls?
 
Hello,

Just out of curiosity, aren't references saved with the workbook? I've always thought that if you set the reference when developing, and save the workbook, that the reference remains. As long as the user has access to the path where the referenced file is, it should work...

Having said that, I have noticied an issue there. If you use a different Excel version, you can run in to issues. We have a user on 97 running on Win 2000, and the VBA Extensibility Pack shows up under a slightly different name than on my Office '03 on Win XP.

As I say, just curious...
 
Upvote 0

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,215,465
Messages
6,124,975
Members
449,200
Latest member
Jamil ahmed

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