View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default How to show User Form when form name is in string?

One way:

Option Explicit
Sub testme()
Dim myStr As String
Dim myUF As Object

myStr = "Userform1"
Set myUF = UserForms.Add(myStr)
myUF.Show
End Sub

Just in case you meant that you knew the userform's name (not as a string):

dim myUF as userform1
set myUF = new userform1
myuf.show



Don Wiss wrote:

If I want to reference a control by a string name I use:
Me.Controls("Checkbox" & i).Value

So, in VBA code how do I display a User Form with the form name in a
string? Application.Run ?

Don <www.donwiss.com (e-mail link at home page bottom).


--

Dave Peterson