Re: How to Change the Caption of a Command button



<dibyendu.tiwary@xxxxxxxxx> wrote in message
news:1130938159.554549.202000@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

> when i click on Edit button then the corresponding text box gets populated
> frm a treeView and changes the Caption of the Respective button to Save.
> When i Click on Save the Caption changes to edit again by updating the
> treeView.

Sub Command1_Click()
With Command1
If .Caption = "Edit" Then
UpdateEditFieldsFromTreeView()
.Caption = "Save"
Else
UpdateTreeViewFromEditFields()
.Caption = "Edit"
End If
End With
End Sub

HTH,
Phill W.


.