button caption not working..

davide128

Board Regular
Joined
May 12, 2010
Messages
58
Why is this not changing the caption when the button is clicked..I want it to change from "Continue" to "Processing..." and it does not work...

this is in a form called PCRForm

Code:
Private Sub CommandButton1_Click()
    If LabelNumberTextBox.Value = "" Then
       MsgBox "Enter a LabelNumber"
    ElseIf ComboBoxFrameType.Value = "" Then
        MsgBox "Select a Frame Type"
    ElseIf ProductTypeComboBox.Value = "" Then
        MsgBox "Select a Product Type"
    Else ' begin processing
        PCRForm.CommandButton1.Caption = "Processing..."
        ConvertToPCRFormat
        PCRForm.Hide
    End If
End Sub
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
This worked for me:

Me.CommandButton1.Caption = "Processing..."

If it doesn't work for you try:

Me.Repaint

on the next line.
 
Upvote 0
Not meaning to highjack this thread but; how would you repaint if the button was on a worksheet instead of a form so "Me" couldn't be used?
 
Upvote 0
You don't need to repaint if the CommandButton is on a worksheet:

Code:
Private Sub CommandButton1_Click()
    With CommandButton1
        If .Caption = "Go" Then
            .Caption = "Stop"
        Else
            .Caption = "Go"
        End If
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,882
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top