Is that commandbutton on the Intro sheet or the Data sheet?
I'm guessing Intro:
Option Explicit
Private Sub Workbook_Open()
With Sheets("Intro")
.Select
MsgBox "Welcome " & "*** " & Application.UserName _
& " ***" & " to the Tracker File.", vbInformation
If Sheets("Data").Range("A1").Value = "" Then
.CommandButton1.Enabled = False
Else
.CommandButton1.Enabled = True
End If
End With
End Sub
Notice the dots in front of .commandbutton1. This means that it belongs to the
object in the previous With statement--in this case the Intro sheet.
Coza wrote:
>
> Private Sub Workbook_Open()
> Sheets("Intro").Activate
> With Application
> MsgBox "Welcome " & "*** " & .UserName & " ***" & " to the Tracker
> File.", vbInformation
> End With
> If Sheets("Data").Range("A1").Value = "" Then
> CommandButton1.Enabled = False
> Else
> CommandButton1.Enabled = True
> End If
> End Sub
>
> The above code returns a Compile error.
>
> How can i get it to work?
>
> Corey....
--
Dave Peterson
|