Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 300
Default How to show User Form when form name is in string?

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).
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default How to show User Form when form name is in string?

Don,

I could not remember how to do this, but Googling came up with this method:

VBA.UserForms.Add("UserForm1").Show

hth,

Doug


"Don Wiss" wrote in message
...
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).



  #3   Report Post  
Posted to microsoft.public.excel.programming
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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
show user form Joanne Links and Linking in Excel 1 February 27th 08 07:52 AM
User form/ to show please wait Momo Excel Programming 10 February 7th 05 02:41 PM
User Form Doesn't Show When Tab is Added novicevbaer[_3_] Excel Programming 1 August 12th 04 08:44 AM
Show user form PCOR Excel Programming 1 December 31st 03 12:15 AM
Only Show User Form Once cornishbloke[_8_] Excel Programming 4 December 29th 03 01:24 PM


All times are GMT +1. The time now is 07:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"