Userforms in a separate worksheet

G

Guest

I am trying to centralize all my macro functions. We have 35 or so users
all using the same macros, so I've created one file they all draw on. Is it
possible to do this with Userforms as well? I'm getting an "error 424 -
Object required". The code reads: "Load mastermacro.xls!UserForm1"
Mastermacro is the filename I've used for my main macro file. The macros run
just dandy, but the userforms won't load. Any suggestions? Any help would
be appreciated.
 
M

merjet

I don't believe you can do it directly. You can run a macro in the
other workbook that loads the form with the following:

Application.Run "OtherWookbookName!MacroThatLoadsForm"

Hth,
Merjet
 
G

Greg Glynn

I think Merjet is correct. I struck this problem recently. I had to
do an export and a re-import of the form, but that doesn't sound like
the fix you need.

Good luck.

Greg
 
A

Alan

Hi Paula,

If your macro is in a workbook module, each time you call it from outside
the workbook the workbook has to open to run the macro. There should be no
reason why the userform wouldn't load if the userform is located in the same
workbook and long as your macro is still running. If your macro is not
running at the time the call for the userform to load, you need to call a
macro inside your macro workbook to open the form.

You can use this in your code: Call Load_Userform1 or call it from outside
just as you call other macros.

Sub Load_Userform1()
Userform1.Show
End Sub

If the userform is located in another workbook by itself, then you need to
use a workbook_open event, in the ThisWorkbook module, to load the userform.
To load this form, just call the file open with a
Workbooks.Open("C:\YourWorkbook") in your macro, which will load the form.

Sub Workbook_Open
Userform1.Show
End Sub

You stand a better chance of getting exactly what you need if you post the
code you are using to call the form.

Regards,

Alan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top