Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Userform.Lable Variables

I have a Userform with numerous Lables whose captions change depending on ...
a coresponding textbox is then enabled true or enabled false - it takes a
load of code to do this - I have tried to store the lable names in a variable
which will reduce code ... but always get the error message "member not found"

question - how do I store a userform lable name in a variable - thankyou in
anticipation
--
Roger
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Userform.Lable Variables

mvar = Userform1.Label1.Caption
msgbox mvar

--
Regards,
Tom Ogilvy

"Roger" wrote in message
...
I have a Userform with numerous Lables whose captions change depending on

....
a coresponding textbox is then enabled true or enabled false - it takes a
load of code to do this - I have tried to store the lable names in a

variable
which will reduce code ... but always get the error message "member not

found"

question - how do I store a userform lable name in a variable - thankyou

in
anticipation
--
Roger



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Userform.Lable Variables

Tom - thanks but its not the caption text I want to store in a variable ...
its the actual Lable name IE

C1 is the name of a lable in a userform called UF1

if I write

UF1.C1.Enabled = True

all OK

if I write

A = "C1"
UF1.A.Enabled = True

I get the error message "member not found"

please tell me how to write this properly
--
Roger


"Roger" wrote:

I have a Userform with numerous Lables whose captions change depending on ...
a coresponding textbox is then enabled true or enabled false - it takes a
load of code to do this - I have tried to store the lable names in a variable
which will reduce code ... but always get the error message "member not found"

question - how do I store a userform lable name in a variable - thankyou in
anticipation
--
Roger

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Userform.Lable Variables

Does this work:

Dim lbl As Control
Set lbl = Me.Label1
lbl.Enabled = False


"Roger" wrote:

Tom - thanks but its not the caption text I want to store in a variable ...
its the actual Lable name IE

C1 is the name of a lable in a userform called UF1

if I write

UF1.C1.Enabled = True

all OK

if I write

A = "C1"
UF1.A.Enabled = True

I get the error message "member not found"

please tell me how to write this properly
--
Roger


"Roger" wrote:

I have a Userform with numerous Lables whose captions change depending on ...
a coresponding textbox is then enabled true or enabled false - it takes a
load of code to do this - I have tried to store the lable names in a variable
which will reduce code ... but always get the error message "member not found"

question - how do I store a userform lable name in a variable - thankyou in
anticipation
--
Roger

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Userform.Lable Variables

UF1.Controls(C1).Enabled = True

--
Regards,
Tom Ogilvy

"Roger" wrote in message
...
Tom - thanks but its not the caption text I want to store in a variable

....
its the actual Lable name IE

C1 is the name of a lable in a userform called UF1

if I write

UF1.C1.Enabled = True

all OK

if I write

A = "C1"
UF1.A.Enabled = True

I get the error message "member not found"

please tell me how to write this properly
--
Roger


"Roger" wrote:

I have a Userform with numerous Lables whose captions change depending

on ...
a coresponding textbox is then enabled true or enabled false - it takes

a
load of code to do this - I have tried to store the lable names in a

variable
which will reduce code ... but always get the error message "member not

found"

question - how do I store a userform lable name in a variable - thankyou

in
anticipation
--
Roger





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Userform.Lable Variables

I think you may have meant:

UF1.Controls(A).Enabled = True
or
UF1.Controls("C1").Enabled = True




Tom Ogilvy wrote:

UF1.Controls(C1).Enabled = True

--
Regards,
Tom Ogilvy

"Roger" wrote in message
...
Tom - thanks but its not the caption text I want to store in a variable

...
its the actual Lable name IE

C1 is the name of a lable in a userform called UF1

if I write

UF1.C1.Enabled = True

all OK

if I write

A = "C1"
UF1.A.Enabled = True

I get the error message "member not found"

please tell me how to write this properly
--
Roger


"Roger" wrote:

I have a Userform with numerous Lables whose captions change depending

on ...
a coresponding textbox is then enabled true or enabled false - it takes

a
load of code to do this - I have tried to store the lable names in a

variable
which will reduce code ... but always get the error message "member not

found"

question - how do I store a userform lable name in a variable - thankyou

in
anticipation
--
Roger


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Userform.Lable Variables

Yeh, I got my A's and C1's confused I guess.
Thanks.

--
Regards,
Tom Ogilvy

"Dave Peterson" wrote in message
...
I think you may have meant:

UF1.Controls(A).Enabled = True
or
UF1.Controls("C1").Enabled = True




Tom Ogilvy wrote:

UF1.Controls(C1).Enabled = True

--
Regards,
Tom Ogilvy

"Roger" wrote in message
...
Tom - thanks but its not the caption text I want to store in a

variable
...
its the actual Lable name IE

C1 is the name of a lable in a userform called UF1

if I write

UF1.C1.Enabled = True

all OK

if I write

A = "C1"
UF1.A.Enabled = True

I get the error message "member not found"

please tell me how to write this properly
--
Roger


"Roger" wrote:

I have a Userform with numerous Lables whose captions change

depending
on ...
a coresponding textbox is then enabled true or enabled false - it

takes
a
load of code to do this - I have tried to store the lable names in a

variable
which will reduce code ... but always get the error message "member

not
found"

question - how do I store a userform lable name in a variable -

thankyou
in
anticipation
--
Roger


--

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
mailing lable Huey Tran Excel Discussion (Misc queries) 1 October 31st 07 10:16 PM
Userform and variables Jeff Excel Discussion (Misc queries) 1 May 24th 06 02:20 PM
Passing variables between Sub and Userform jose luis Excel Programming 8 July 22nd 05 05:20 PM
lable ranges in Excell david Excel Discussion (Misc queries) 2 February 2nd 05 11:26 PM
Passing variables from module to userform Chris Dunigan Excel Programming 4 November 26th 03 09:37 AM


All times are GMT +1. The time now is 07:24 AM.

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"