W
Waterman
This one is probably really simple.
The form I have only has two command buttons on it. The
code below will allow me to change the fore color of
command1 by clicking command0.
Private Sub Command0_Click()
Dim btnname As CommandButton
Set btnname = Command1
btnname.ForeColor = vbRed
End Sub
What I am trying to accomplish is use a string variable to
allow me to state the name of the command button.
Private Sub Command0_Click()
Dim btnname As CommandButton
Dim strName as string
strName = "Command1"
Set btnname = strName
btnname.ForeColor = vbRed
End Sub
The error I'm getting is "type mismatch". It sure seems
like a simply enough thing to accomplish, but I have to
admit that I'm stumped. Can you help?
The form I have only has two command buttons on it. The
code below will allow me to change the fore color of
command1 by clicking command0.
Private Sub Command0_Click()
Dim btnname As CommandButton
Set btnname = Command1
btnname.ForeColor = vbRed
End Sub
What I am trying to accomplish is use a string variable to
allow me to state the name of the command button.
Private Sub Command0_Click()
Dim btnname As CommandButton
Dim strName as string
strName = "Command1"
Set btnname = strName
btnname.ForeColor = vbRed
End Sub
The error I'm getting is "type mismatch". It sure seems
like a simply enough thing to accomplish, but I have to
admit that I'm stumped. Can you help?