Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Initiating a Custom Toolbar

I have made a custom toolbar to work with a specific spreadsheet. I need the
toolbar to load if the user doesn't have it already. This is what I'm trying
to do:

Private Sub Workbook_Open()

If "Application.Toolbar X exists" Then "do nothing"
Else: Call "procedure to make toolbar"
End If

End Sub

Just need help filling in the correct syntax to make this work.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Initiating a Custom Toolbar

dim cbr as commandbar

on error resume next
set cbr = application.commadbars(x)
on error goto 0

if cbr is nothing then
'open the bar
end if
--
HTH...

Jim Thomlinson


"Bishop" wrote:

I have made a custom toolbar to work with a specific spreadsheet. I need the
toolbar to load if the user doesn't have it already. This is what I'm trying
to do:

Private Sub Workbook_Open()

If "Application.Toolbar X exists" Then "do nothing"
Else: Call "procedure to make toolbar"
End If

End Sub

Just need help filling in the correct syntax to make this work.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Initiating a Custom Toolbar

Same problem. Works if the toolbar isn't already present but if it's there I
get a "Invalid procedure call or element" error. Below is my code:

Private Sub Workbook_Open()

Dim cbr As CommandBar

On Error Resume Next
Set cbr = Application.commadbars("CDToolBar")
On Error GoTo 0

If cbr Is Nothing Then
Call CatalystDumpToolBar
Call AddCustomControl
End If

If ThisWorkbook.Name Like "Master*" Then NotSoFast.Show
End Sub

the above code runs even if the toolbar is present and then goes he

Sub CatalystDumpToolBar()

Dim CDToolBar As CommandBar

Set CDToolBar = CommandBars.Add(temporary:=True)
With CDToolBar
.Name = "CDToolBar"
.Position = msoBarTop
.Visible = True
End With
End Sub

This is where I get the error: .Name = "CDToolBar".

"Jim Thomlinson" wrote:

dim cbr as commandbar

on error resume next
set cbr = application.commadbars(x)
on error goto 0

if cbr is nothing then
'open the bar
end if
--
HTH...

Jim Thomlinson


"Bishop" wrote:

I have made a custom toolbar to work with a specific spreadsheet. I need the
toolbar to load if the user doesn't have it already. This is what I'm trying
to do:

Private Sub Workbook_Open()

If "Application.Toolbar X exists" Then "do nothing"
Else: Call "procedure to make toolbar"
End If

End Sub

Just need help filling in the correct syntax to make this work.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Initiating a Custom Toolbar

Maybe it's because you spelled commandbars incorrectly. And the "on error
resume next" line hid that spelling mistake.

Bishop wrote:

Same problem. Works if the toolbar isn't already present but if it's there I
get a "Invalid procedure call or element" error. Below is my code:

Private Sub Workbook_Open()

Dim cbr As CommandBar

On Error Resume Next
Set cbr = Application.commadbars("CDToolBar")
On Error GoTo 0

If cbr Is Nothing Then
Call CatalystDumpToolBar
Call AddCustomControl
End If

If ThisWorkbook.Name Like "Master*" Then NotSoFast.Show
End Sub

the above code runs even if the toolbar is present and then goes he

Sub CatalystDumpToolBar()

Dim CDToolBar As CommandBar

Set CDToolBar = CommandBars.Add(temporary:=True)
With CDToolBar
.Name = "CDToolBar"
.Position = msoBarTop
.Visible = True
End With
End Sub

This is where I get the error: .Name = "CDToolBar".

"Jim Thomlinson" wrote:

dim cbr as commandbar

on error resume next
set cbr = application.commadbars(x)
on error goto 0

if cbr is nothing then
'open the bar
end if
--
HTH...

Jim Thomlinson


"Bishop" wrote:

I have made a custom toolbar to work with a specific spreadsheet. I need the
toolbar to load if the user doesn't have it already. This is what I'm trying
to do:

Private Sub Workbook_Open()

If "Application.Toolbar X exists" Then "do nothing"
Else: Call "procedure to make toolbar"
End If

End Sub

Just need help filling in the correct syntax to make this work.


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Initiating a Custom Toolbar

That was exactly it! Corrected the spelling and it works now. Thanks for
pointing that out.

"Dave Peterson" wrote:

Maybe it's because you spelled commandbars incorrectly. And the "on error
resume next" line hid that spelling mistake.

Bishop wrote:

Same problem. Works if the toolbar isn't already present but if it's there I
get a "Invalid procedure call or element" error. Below is my code:

Private Sub Workbook_Open()

Dim cbr As CommandBar

On Error Resume Next
Set cbr = Application.commadbars("CDToolBar")
On Error GoTo 0

If cbr Is Nothing Then
Call CatalystDumpToolBar
Call AddCustomControl
End If

If ThisWorkbook.Name Like "Master*" Then NotSoFast.Show
End Sub

the above code runs even if the toolbar is present and then goes he

Sub CatalystDumpToolBar()

Dim CDToolBar As CommandBar

Set CDToolBar = CommandBars.Add(temporary:=True)
With CDToolBar
.Name = "CDToolBar"
.Position = msoBarTop
.Visible = True
End With
End Sub

This is where I get the error: .Name = "CDToolBar".

"Jim Thomlinson" wrote:

dim cbr as commandbar

on error resume next
set cbr = application.commadbars(x)
on error goto 0

if cbr is nothing then
'open the bar
end if
--
HTH...

Jim Thomlinson


"Bishop" wrote:

I have made a custom toolbar to work with a specific spreadsheet. I need the
toolbar to load if the user doesn't have it already. This is what I'm trying
to do:

Private Sub Workbook_Open()

If "Application.Toolbar X exists" Then "do nothing"
Else: Call "procedure to make toolbar"
End If

End Sub

Just need help filling in the correct syntax to make this work.


--

Dave Peterson

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
hide custom toolbar from Toolbar list tracktraining Excel Programming 3 February 26th 09 09:28 PM
Need help w using custom image for custom toolbar in Excel 2007 vbaexperimenter Excel Programming 10 June 23rd 08 06:05 PM
adding custom images to a button on custom toolbar Mousam Excel Programming 1 July 13th 07 04:28 PM
custom toolbar buttons are saved where? Excel loads twice bymistake and all my custom toolbar buttons get gone!!! Kevin Waite Excel Programming 2 March 3rd 04 03:31 PM
saving toolbar buttons on custom toolbar Paul James Excel Programming 12 August 6th 03 08:28 AM


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