Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default commandbar at workbook before close - run time error

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
error message Method €˜Add of object €˜CommandBar Controls fail? Sandy Pringle Excel Discussion (Misc queries) 2 October 30th 09 02:45 PM
In-place CommandBar.Add run-time error ARHangel Excel Discussion (Misc queries) 4 October 11th 07 06:17 AM
run-time error '91'-Close Button error ASCO IS Help Excel Discussion (Misc queries) 1 May 8th 06 04:25 PM
Close a the current workbook and load another specified workbook Adrian[_7_] Excel Programming 4 August 7th 04 05:29 PM
When running workbook.close True Excel generates an error!!! Daniel[_10_] Excel Programming 2 May 11th 04 05:31 PM


All times are GMT +1. The time now is 12:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"