Showing a userform

T

Todd Huttenstine

How do I call a userform (userform1) from another workbook
called test.xls?
Normally you would day userform1.show but when its on
another workbook it
does not work. I have done it before I just forgot the
code.

Thanx

Todd Huttenstine
 
B

Bob Phillips

Todd,

You can't directly open the form from another project (file). You could
create a Public Sub in the project containing the form, and then call that
procedure from the other project using Application.Run. So in the project
with the form, say workbook myFormBook, add

Public Sub ShowForm()
UserForm1.Show
End Sub

Then, you can call this with Application.Run from the other project with

Application.Run "'myFormBook.xls'!ShowForm"


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
T

Todd Huttenstine

Great! Thank you.

-----Original Message-----
Todd,

You can't directly open the form from another project (file). You could
create a Public Sub in the project containing the form, and then call that
procedure from the other project using Application.Run. So in the project
with the form, say workbook myFormBook, add

Public Sub ShowForm()
UserForm1.Show
End Sub

Then, you can call this with Application.Run from the other project with

Application.Run "'myFormBook.xls'!ShowForm"


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)




.
 
G

Guest

Hi
Put this code in a module in Book2.xls (The workbook with
the Userform)

Sub Userform1_Show()
UserForm1.Show
End Sub

In a module in Book1.xls insert the following code

Sub UserformBook2()
Application.Run ("Book2.xls!Userform1_Show")
End Sub

Hope this helps
Peter Scott
 

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