View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default commandbar at workbook before close - run time error

Hi
see your other post

--
Regards
Frank Kabel
Frankfurt, Germany

"tango" schrieb im Newsbeitrag
om...
Dear All, why beforeclose i got this message at set cmd =

commandbars("Tender Bar")
run time error 91
object variable or with block variable not set?

click commandbutton works fine.
pls help.
thanks



Private Sub Workbook_BeforeClose(Cancel As Boolean)
disable
End Sub

Sub disable()
Dim cmd As CommandBar
Set cmd = CommandBars("Tender Bar")
cmd.Controls("&KC").Enabled = False
End Sub


Private Sub CommandButton1_Click()
enable
End Sub

Sub enable()
Dim cmd As CommandBar
Set cmd = CommandBars("Tender Bar")
cmd.Controls("&KC").Enabled = True
End Sub