EPamperin12
04-10-2008, 12:34 PM
I have a form that is used by multiple teams. I had 5 command buttons for different steps that this form goes through. I had originally thought that I would be able to stack the buttons on top of each other and then delete the button after it had been clicked. However when it was emailed the buttons get stacked in a different order. I devised a way around this by using 1 command button that has a variable assigned with it and when it is clicked it will be able to perform a different task, depending on what the variable is. Is there a way to change the Caption on the command button by using VBA?
Any assistance is most appreciated.
Dim b as Integer ' Module Variable
Private Sub CommandButton1_Click()
If b = 0 Then
b = b + 1
ElseIf b < 0 Or b >= 2 Then
MsgBox "You must Open the Original Document"
ActiveDocument.Close (RouteDocument)
End If
If b = 1 Then
Application.Run ("CSCompleted")
'Want the Caption to be Internal Set Up Completed
b = 2
ElseIf b = 2 Then
Application.Run ("InternalCompleted")
'Want Caption to be Extract
b = 3
ElseIf b = 3 Then
Application.Run ("Extract")
'Want Caption to be Send to QC
b = 4
ElseIf b = 4 Then
Application.Run ("SendtoQC")
'Want Caption to be QC Completed
b = 5
ElseIf b = 5 Then
Application.Run ("QCCompleted")
'Will Delete Command Button
b = 6
Else
End If
End Sub
Any assistance is most appreciated.
Dim b as Integer ' Module Variable
Private Sub CommandButton1_Click()
If b = 0 Then
b = b + 1
ElseIf b < 0 Or b >= 2 Then
MsgBox "You must Open the Original Document"
ActiveDocument.Close (RouteDocument)
End If
If b = 1 Then
Application.Run ("CSCompleted")
'Want the Caption to be Internal Set Up Completed
b = 2
ElseIf b = 2 Then
Application.Run ("InternalCompleted")
'Want Caption to be Extract
b = 3
ElseIf b = 3 Then
Application.Run ("Extract")
'Want Caption to be Send to QC
b = 4
ElseIf b = 4 Then
Application.Run ("SendtoQC")
'Want Caption to be QC Completed
b = 5
ElseIf b = 5 Then
Application.Run ("QCCompleted")
'Will Delete Command Button
b = 6
Else
End If
End Sub