View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tim[_15_] Tim[_15_] is offline
external usenet poster
 
Posts: 6
Default Enabling a Embedded Control

Kirk, try somnething like this. Note that the button will not be disabled
(Enabled = False), but that it just won't do anything unless the WksUpdated
function returns True.

Option Explicit

Private Sub CommandButton1_Click()
Dim WksUpdated As Boolean
If WksUpdated Then
MsgBox "It must be updated!" 'code to run if updated goes here
Else
MsgBox "Apparently not updated!"
End If
End Sub

Private Function WksUpdated() As Boolean
If Range("A1").Value = True Then 'example of "updated correctly"
WksUpdated = True
Else
WksUpdated = False
End If
End Function

"Kirk" wrote in message
...
I added a command button control to a spreadsheet. I
have it intially disabled, but want to enable it after
the spreadsheet has been updated correctly. I want to
enable it through VBA code. How do I do this? I'm sure
it is simple and I am overlooking something.

As always, all help is appreciated.

Thanks.

Kirk