Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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.... |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Enable/Disable Macros Pop-Up | Excel Discussion (Misc queries) | |||
Update Cell in WKBook 1 From WkBook 2 | Excel Discussion (Misc queries) | |||
Using Checkboxes to enable/disable vb | Excel Programming | |||
Suppress "Disable/Enable Macros" and Query Refresh dialog on open | Excel Programming | |||
Enable/Disable Worksheet Change Event code | Excel Programming |