Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 16
Default Calling a Userform from a Predefined Variable

Hello to all,

In my code, I have a variable that represents the name of a UserForm
that will be opened as a result of a call to a function. However,
what I have errors out with "this object does not support this
property or method". How can I open the appropriate existing form
based on this string representing the form name?

This is what I currently have:

Dim FormName As String

FormName = "FieldUserForm"
FormStuff FormName

Function FormStuff(FormName As String)
With FormName
.Show
.Textbox1.Visible = False
.Textbox2.Visible = False
.Textbox3.Visible = True
.Textbox4.Visible = False
.Textbox5.Visible = True
End With
End Function


I've tried even making the Dim variable "As UserForm" but that didn't
work either. Any ideas? Or should I be going about this a different
way? Reason I want the separate function is because there are more
than one UserForms that I want to show at different stages in the
macro. So later on I want to call the same function with a different
UserForm name:

FormName = "OfficeUserForm"
FormStuff FormName


Thanks in advance!

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
Userform and variable Jeff Excel Discussion (Misc queries) 1 March 16th 07 03:14 PM
Defining UserForm Caption from a Variable [email protected] Excel Worksheet Functions 1 January 3rd 07 02:30 PM
Calling function from a userform Jeff Excel Discussion (Misc queries) 0 September 27th 06 03:27 PM
Calling a procudure through variable name Basu Excel Discussion (Misc queries) 2 August 30th 06 08:55 AM
calling variable within string [email protected] Excel Worksheet Functions 8 May 4th 06 03:07 PM


All times are GMT +1. The time now is 06:57 AM.

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

About Us

"It's about Microsoft Excel"