Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Select option button when have the name as a string

Hi All

During the running of my VBA code, I collect the name of an option button from an Access database. I then want to set the value of the option button on a form. My problem is that I have the name of the button as a string and just cannot see how to use that to set the value of the button on the form as, when used as a string, I get an error.

Hope the question makes sense to someone :-)

Many thanks
Deb

--
Message posted via http://www.officekb.com
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Select option button when have the name as a string

Deb,

Use
Me.Controls(string_value)

with whatever property you want

--
HTH

Bob Phillips

"Debbie Probert via OfficeKB.com" wrote in message
...
Hi All

During the running of my VBA code, I collect the name of an option button

from an Access database. I then want to set the value of the option button
on a form. My problem is that I have the name of the button as a string and
just cannot see how to use that to set the value of the button on the form
as, when used as a string, I get an error.

Hope the question makes sense to someone :-)

Many thanks
Deb

--
Message posted via http://www.officekb.com



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Select option button when have the name as a string

Private Sub CommandButton2_Click()
sStr = "Button Name"
UserForm1.Optionbutton1.Caption = sStr
End Sub

I assume by name you mean the name you would see next to the button on the
form.

--
Regaards,
Tom Ogilvy



"Debbie Probert via OfficeKB.com" wrote in message
...
Hi All

During the running of my VBA code, I collect the name of an option button

from an Access database. I then want to set the value of the option button
on a form. My problem is that I have the name of the button as a string and
just cannot see how to use that to set the value of the button on the form
as, when used as a string, I get an error.

Hope the question makes sense to someone :-)

Many thanks
Deb

--
Message posted via http://www.officekb.com



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
Can I select more than one option in a drop down box? megs Excel Discussion (Misc queries) 5 February 15th 11 10:33 AM
Select Option button unhide row Wanna Learn Excel Discussion (Misc queries) 5 March 7th 08 06:38 PM
keep source formatting is not an option in paste option button Tina Excel Discussion (Misc queries) 0 February 20th 06 09:58 PM
Can't select macro button after other button is pressed C. Campbell Excel Programming 1 November 30th 04 07:46 PM
Option buttons to select a row of cells mikewild2000[_2_] Excel Programming 2 December 27th 03 02:37 AM


All times are GMT +1. The time now is 07:58 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"