+ Reply to Thread
Results 1 to 2 of 2

Strange Option Button behaviour

  1. #1
    christopher.lepingwell@gs.com
    Guest

    Strange Option Button behaviour

    Hi all,

    I have just noticed some odd behaviour while programming a userform in
    Excel 2003 (SP2):

    I have some option buttons that I set during the initialise event of
    the form. I tried setting the values to 'vbTrue' and I get the
    grayed-out version of the button (i.e. value = Null). If I set the
    value to 'True', the button is correctly selected.

    This puzzles me as I was under the impression that 'vbTrue' and 'True'
    are equivalent. If I compare them in the immediate pane, they are
    equivalent, and the the help for the OptionButton says that -1 (the
    value of vbTrue) is an aceptable value to flag the button as true.

    Had anyone else seen this behaviour, or should I start worrting about
    the stablility of the system! The systems guys here do use my machine
    as a test box for new patches to the system, so I'm wondering if the
    latest roll-out has broken something.

    Cheers,

    Chris


  2. #2
    Tom Ogilvy
    Guest

    RE: Strange Option Button behaviour

    You can see they are not the same from that same immediate window:

    ? typename(vbtrue)
    Long
    ? typename(true)
    Boolean

    If you convert True to a long, it will equal -1. but apparently the
    properties want True or False. (an option button can be true, false, or Null
    - it appears to interpret vbtrue as a request to be Null).

    Don't think you need to worry about your machine.

    --
    Regards,
    Tom Ogilvy


    No need for concern. If you assign the value as vbtrue, then move from that
    property, I believe you will see it gets cleared because that is not a valid
    setting when set manually.




    "christopher.lepingwell@gs.com" wrote:

    > Hi all,
    >
    > I have just noticed some odd behaviour while programming a userform in
    > Excel 2003 (SP2):
    >
    > I have some option buttons that I set during the initialise event of
    > the form. I tried setting the values to 'vbTrue' and I get the
    > grayed-out version of the button (i.e. value = Null). If I set the
    > value to 'True', the button is correctly selected.
    >
    > This puzzles me as I was under the impression that 'vbTrue' and 'True'
    > are equivalent. If I compare them in the immediate pane, they are
    > equivalent, and the the help for the OptionButton says that -1 (the
    > value of vbTrue) is an aceptable value to flag the button as true.
    >
    > Had anyone else seen this behaviour, or should I start worrting about
    > the stablility of the system! The systems guys here do use my machine
    > as a test box for new patches to the system, so I'm wondering if the
    > latest roll-out has broken something.
    >
    > Cheers,
    >
    > Chris
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1