PC Review


Reply
Thread Tools Rate Thread

disable option button on user form

 
 
JH
Guest
Posts: n/a
 
      4th May 2009
I have a large number of workbooks with an user form, the user form shows up
when the workbook is open. I am trying to disable one of the option buttons
on the user form. How can I do it programmatically?
Thanks!

JH
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      4th May 2009
OptionButton1.Enabled = False

If this post helps click Yes
---------------
Jacob Skaria


"JH" wrote:

> I have a large number of workbooks with an user form, the user form shows up
> when the workbook is open. I am trying to disable one of the option buttons
> on the user form. How can I do it programmatically?
> Thanks!
>
> JH

 
Reply With Quote
 
Susan
Guest
Posts: n/a
 
      4th May 2009
if you want it disabled always, you can do that in the userform
properties.

if you want it disabled due to a certain condition when the userform
opens, you can do it programatically in the userform_initialize sub

if xxxxxxxx then
optionbutton1.enabled=false
else
optionbutton1.enabled=true
end if

where "xxxxxxx" is your condition.
hope that helps.

susan



On May 4, 10:32*am, JH <J...@discussions.microsoft.com> wrote:
> I have a large number of workbooks with an user form, the user form showsup
> when the workbook is open. *I am trying to disable one of the option buttons
> on the user form. *How can I do it programmatically?
> Thanks!
>
> JH


 
Reply With Quote
 
JH
Guest
Posts: n/a
 
      4th May 2009
Hi,
I added this line to my macro. " frmMenu.opt1.Enabled = false", I got
an error message, "Object required". The macro is located in another
workbook. I am intended to use this macro to loop through all the workbooks
that needed changes.
The code is as follow:

................................
fname = Dir(pname, vbNormal)
Do
If Len(fname) < 28 Then

Workbooks.Open FileName:=pname & fname, UpdateLinks:=False
frmMenu.opt1.Enabled = False
Workbooks(fname).Close saveChanges:=True
End If
fname = Dir() 'get another filename
Loop Until fname = ""
----------------------------------------------
Thanks!
JH

"Jacob Skaria" wrote:

> OptionButton1.Enabled = False
>
> If this post helps click Yes
> ---------------
> Jacob Skaria
>
>
> "JH" wrote:
>
> > I have a large number of workbooks with an user form, the user form shows up
> > when the workbook is open. I am trying to disable one of the option buttons
> > on the user form. How can I do it programmatically?
> > Thanks!
> >
> > JH

 
Reply With Quote
 
Susan
Guest
Posts: n/a
 
      7th May 2009
since the userform is in another workbook, you need to qualilfy your
workbooks (which you're already doing).

try something like

Workbooks(fname).frmMenu.opt1.Enabled = false

then it knows WHERE to find frmMenu.
hope it helps.

susan


On May 4, 1:51*pm, JH <J...@discussions.microsoft.com> wrote:
> Hi,
> * * *I added this line to my macro. " frmMenu.opt1.Enabled = false", I got
> an error message, "Object required". *The macro is located in another
> workbook. *I am intended to use this macro to loop through all the workbooks
> that needed changes.
> The code is as follow:
>
> ...............................
> fname = Dir(pname, vbNormal)
> Do
> If Len(fname) < 28 Then
>
> * Workbooks.Open FileName:=pname & fname, UpdateLinks:=False
> * frmMenu.opt1.Enabled = False * * * * *
> * Workbooks(fname).Close saveChanges:=True
> End If
> fname = Dir() * *'get another filename
> Loop Until fname = ""
> ----------------------------------------------
> Thanks!
> JH
>
>
>
> "Jacob Skaria" wrote:
> > OptionButton1.Enabled = False

>
> > If this post helps click Yes
> > ---------------
> > Jacob Skaria

>
> > "JH" wrote:

>
> > > I have a large number of workbooks with an user form, the user form shows up
> > > when the workbook is open. *I am trying to disable one of the option buttons
> > > on the user form. *How can I do it programmatically?
> > > Thanks!

>
> > > JH- Hide quoted text -

>
> - Show quoted text -


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Option Button in User Form Susan Microsoft Excel Programming 1 8th Jul 2009 04:22 PM
Re: how to disable option button in a frame Allen Browne Microsoft Access Forms 0 26th Feb 2009 02:20 AM
Disable the Option button in Logon Dan Microsoft Windows 2000 Active Directory 1 11th May 2004 03:38 PM
Disable the Option button in Logon Dan Microsoft Windows 2000 Group Policy 1 11th May 2004 03:38 PM
Difficulties in VBA ( User form and option button) paradise Microsoft Excel Programming 2 28th Oct 2003 01:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:50 AM.