Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Exel2000 VBA - Creating a Command Bar - Error: "Object Variable or With not Set"


In addition to Tom's remark:

I see a hard return but no line continuation where you add the Button?

Use:

Set btnRun = barTemp.Controls.Add _
(Type:=msoControlButton, temporary:=True)


Also:

Dim btnRun as Office.CommandBarButton

the CommandBarControl is more generic.. if u use CommandBarButton Object
you'll see more properties to work with.


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Tom Ogilvy" wrote:

in the workbook_open event you should prefix with application


Private Sub Workbook_Open()
Dim barTemp As CommandBar
Dim btnRun As CommandBarControl

Set barTemp = Application.CommandBars.Add(Name:="Temp", _
Position:=msoBarFloating, MenuBar:=False, temporary:=True)

Set btnRun = barTemp.Controls.Add
(Type:=msoControlButton, temporary:=True)

End Sub

This usually clears up this type of problem.

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
Insert row/column error "Cannot shift object off sheet" Michelle Roach Excel Discussion (Misc queries) 2 May 23rd 08 05:51 PM
cannot insert rows -error message "cannot shift object off sheet" robwan Excel Discussion (Misc queries) 1 November 10th 07 03:01 PM
When hiding column error messge"Can'nt shift object off sheet" Rajeev Sharma Excel Discussion (Misc queries) 1 September 18th 06 01:27 PM
"Microsoft Visual Basic runtime error '424' object required". SharonG. Excel Worksheet Functions 0 July 5th 06 01:36 AM
I get an error message that says "Cannot shift object off a page" JZygmun Excel Discussion (Misc queries) 1 March 7th 06 02:18 AM


All times are GMT +1. The time now is 01:13 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"