Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
hide custom toolbar from Toolbar list | Excel Programming | |||
Need help w using custom image for custom toolbar in Excel 2007 | Excel Programming | |||
adding custom images to a button on custom toolbar | Excel Programming | |||
custom toolbar buttons are saved where? Excel loads twice bymistake and all my custom toolbar buttons get gone!!! | Excel Programming | |||
saving toolbar buttons on custom toolbar | Excel Programming |