LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Creating a Toolbar with a macro

I have the following code which should create a command bar and add 17
buttons. I shortened the example to 3 buttons to save readers time.

Sub Workbook_Open()

'Delete CommandBar if it exists
On Error Resume Next
CommandBars("DataEntry").Delete
On Error GoTo 0

CommandBars.Add Name:="DataEntry"

With
Application.CommandBars("DataEntry").Controls.Add( temporary:=True)
.Caption = "Anti Virus"
.OnAction = "PasteAntiVirus"
End With

With
Application.CommandBars("DataEntry").Controls.Add( temporary:=True)
.Caption = "Audio"
.OnAction = "PasteAudio"
End With

With
Application.CommandBars("DataEntry").Controls.Add( temporary:=True)
.Caption = "Backup"
.OnAction = "PasteBackup"
End With

End Sub

When I open the spreadsheet the macro stops at the line

CommandBars.Add Name:="DataEntry"

The error message is "Run Time error '91' Object Variable ot With
Block Variable not set

I have looked through previous postings but none seem relevant to my
problem. The macro runs when I open the spreadsheet. My XL version
is 2000 running on Win98.

Can anyone point me in the right direction please

David P
 
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
Repetive Formatting/Creating a Toolbar button rllngriver Excel Discussion (Misc queries) 11 November 21st 07 01:38 PM
Creating Custom Commands on a Toolbar rllngriver Excel Worksheet Functions 1 November 19th 07 07:07 PM
XLSTART-Creating a toolbar Andre Setting up and Configuration of Excel 2 November 1st 07 05:20 PM
macro toolbar Ankur Excel Discussion (Misc queries) 3 August 5th 06 01:55 AM
Creating a macro that simulates some of the toolbar button Duangruthai New Users to Excel 1 April 22nd 06 12:12 AM


All times are GMT +1. The time now is 08:06 AM.

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

About Us

"It's about Microsoft Excel"