Showing a userform

  • Thread starter Thread starter Todd Huttenstine
  • Start date Start date
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
 
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)
 
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)




.
 
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
 
Back
Top