View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Beto[_3_] Beto[_3_] is offline
external usenet poster
 
Posts: 140
Default Disable Button when no workbooks are open.

JE McGimpsey wrote:

In any case, here's the correct code in my DimButtonClass module:

Public WithEvents DBApp As Application

Private Sub DBApp_WorkbookDeactivate(ByVal Wb As Excel.Workbook)
On Error Resume Next
CommandBars.FindControl(Tag:=csCTRLTAG).Enabled = _
(Workbooks.Count 1)
On Error GoTo 0
End Sub

Private Sub DBApp_WorkbookOpen(ByVal Wb As Excel.Workbook)
On Error Resume Next
CommandBars.FindControl(Tag:=csCTRLTAG).Enabled = True
On Error GoTo 0
End Sub

Again, sorry for my mix-up.


Now it's working great!

Thanks!
--
Beto
Reply: Erase between the dot (inclusive) and the @.
Responder: Borra la frase obvia y el punto previo.