+ Reply to Thread
Results 1 to 3 of 3

changing the caption of a command button

  1. #1
    JWCrosby
    Guest

    changing the caption of a command button

    I have a command button that when clicked runs a VB script that carries out a
    complex calculation. Right now, the caption for the button reads,
    "Calculate".

    I'd like it to switch to read, "Working" while it is doing the calculating
    and then back to "Calculate" when it's done.

    If I enter Me.CommandButton1.Caption = "Working" at the beginning of the
    script, it doesn't change. Probably not refreshing.

    Is there a way to get it to change while it's calculating?

    Thanks in advance.

    Jerry

  2. #2
    Jim Thomlinson
    Guest

    RE: changing the caption of a command button

    Based on your code I assume that the button comes from the Control Toolbox.
    Is screen updating on or off? I assume that the button is embedded in the
    sheet.

    Instead of using me. have you tired referencing the sheet directly like

    Sheet1.CommandButton1.Caption = "Working"

    As a complete aside I tend to use the status bar to preform this function
    instead of changing button captions. It is a little less of a problem to
    reset if things go wrong...

    Application.statusbar = "Calculating. Please Wait..."
    'Your code
    application.statusbar = false

    --
    HTH...

    Jim Thomlinson


    "JWCrosby" wrote:

    > I have a command button that when clicked runs a VB script that carries out a
    > complex calculation. Right now, the caption for the button reads,
    > "Calculate".
    >
    > I'd like it to switch to read, "Working" while it is doing the calculating
    > and then back to "Calculate" when it's done.
    >
    > If I enter Me.CommandButton1.Caption = "Working" at the beginning of the
    > script, it doesn't change. Probably not refreshing.
    >
    > Is there a way to get it to change while it's calculating?
    >
    > Thanks in advance.
    >
    > Jerry


  3. #3
    JWCrosby
    Guest

    RE: changing the caption of a command button

    Thanks, Jim. That's a simpler, yet just as effective, method.

    Jerry

    "Jim Thomlinson" wrote:

    > Based on your code I assume that the button comes from the Control Toolbox.
    > Is screen updating on or off? I assume that the button is embedded in the
    > sheet.
    >
    > Instead of using me. have you tired referencing the sheet directly like
    >
    > Sheet1.CommandButton1.Caption = "Working"
    >
    > As a complete aside I tend to use the status bar to preform this function
    > instead of changing button captions. It is a little less of a problem to
    > reset if things go wrong...
    >
    > Application.statusbar = "Calculating. Please Wait..."
    > 'Your code
    > application.statusbar = false
    >
    > --
    > HTH...
    >
    > Jim Thomlinson
    >
    >
    > "JWCrosby" wrote:
    >
    > > I have a command button that when clicked runs a VB script that carries out a
    > > complex calculation. Right now, the caption for the button reads,
    > > "Calculate".
    > >
    > > I'd like it to switch to read, "Working" while it is doing the calculating
    > > and then back to "Calculate" when it's done.
    > >
    > > If I enter Me.CommandButton1.Caption = "Working" at the beginning of the
    > > script, it doesn't change. Probably not refreshing.
    > >
    > > Is there a way to get it to change while it's calculating?
    > >
    > > Thanks in advance.
    > >
    > > Jerry


+ 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