## Recommended Posts

Now I have this code: (to change the color of text) Private Sub Command1_Click() (HIGHLIGHTED HERE) If Option1.Value = True Then Form1.Text1.ForeColor = vbRed If Option2.Value = True Then Form1.Text1.ForeColor = vbBlue If Option3.Value = True Then Form1.Text1.ForeColor = vbBlack If Option4.Value = True Then Form1.Text1.ForeColor = vbGreen If Option5.Value = True Then Form1.Text1.Appearance = 1 If Option6.Value = True Then Form1.Text1.Appearance = 0 If Check1.Value = 1 Then Form1.Text1.FontBold = True Else Form1.Text1.FontBold = False End If If Check2.Value = 1 Then Form1.Text1.Font.Italic = True Else Form1.Text1.Font.Italic = False End If Form2.Hide End Sub The first line for the Command click button is hightlighted. The error is method or data member not found. Can somebody help again?? thanks

##### Share on other sites
I didn't get any error so there's no problem with the code. Make sure though all the referenced Controls exist and that they have the name you've specified in your code.

Oh I changed an Else-statement that didn't have an If but it was probably just messed up when pasting into the post I suppose.

Private Sub Command1_Click()If Option1.Value = True Then Form1.Text1.ForeColor = vbRedIf Option2.Value = True Then Form1.Text1.ForeColor = vbBlueIf Option3.Value = True Then Form1.Text1.ForeColor = vbBlackIf Option4.Value = True Then Form1.Text1.ForeColor = vbGreenIf Option5.Value = True Then Form1.Text1.Appearance = 1If Option6.Value = True Then Form1.Text1.Appearance = 0If Check1.Value = 1 ThenForm1.Text1.FontBold = TrueElseForm1.Text1.FontBold = FalseEnd IfIf Check2.Value = 1 ThenForm1.Text1.Font.Italic = TrueElseForm1.Text1.Font.Italic = FalseEnd IfForm2.HideEnd Sub

\Jimmy H

##### Share on other sites
Maybe this will sound stupid, but do you have a button named Command1 on the form?

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628402
• Total Posts
2982470

• 9
• 10
• 9
• 19
• 24