#1   Report Post  
Posted to microsoft.public.excel.programming
ksn ksn is offline
external usenet poster
 
Posts: 7
Default Code Error

This was old code from Excel 95 and I want to convert this to the latest.
Basically this macro pulls up a custom toolbar with an assigned macro to run
on action.

'
'
'
'
'
' ********************
' Auto_Open Macro
' Opens with File
' ********************
Sub Auto_Open()
Application.Toolbars("Titles").Visible = True
Application.Toolbars("Titles").Top = 0
Application.Toolbars("Titles").Left = 0
Application.Toolbars("Titles").ToolbarButtons(1).O nAction = "SetTitles"
Application.Toolbars("Titles").ToolbarButtons(2).O nAction = "DelTitles"
End Sub
'
'
'
'
'
' ********************
' Auto_Close Macro
' Closes with File
' ********************
Sub Auto_Close()
Application.Toolbars("Titles").Visible = False
Application.Toolbars("Fee").Visible = False
Application.Toolbars("Hide_Unhide").Visible = False
End Sub


I tried the following and VBA gives an error on the fourth line stating
Method or data member not found.

Private Sub Workbook_Open()
Application.CommandBars("Titles").Visible = True
Application.CommandBars("Titles").Top = 0
Application.CommandBars("Titles").Left = 0
Application.CommandBars("Titles").CommandBarButton (1).OnAction =
"SetTitles"
Application.CommandBars("Titles").CommandBarButton (2).OnAction =
"DelTitles"
End Sub
'
'
'
'
' ********************
' Closes Toolbars
'
' ********************
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.Toolbars("Titles").Visible = False
Application.Toolbars("Fee").Visible = False
Application.Toolbars("Hide_Unhide").Visible = False
End Sub




--
ksn
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Code Error

Private Sub Workbook_Open()
Application.CommandBars("Titles").Visible = True
Application.CommandBars("Titles").Top = 0
Application.CommandBars("Titles").Left = 0
Application.CommandBars("Titles").Controls(1).OnAc tion = _
"SetTitles"
Application.CommandBars("Titles").Controls.OnActio n = _
"DelTitles"
End Sub

--
Regards,
Tom Ogilvy


"ksn" wrote in message
...
This was old code from Excel 95 and I want to convert this to the latest.
Basically this macro pulls up a custom toolbar with an assigned macro to

run
on action.

'
'
'
'
'
' ********************
' Auto_Open Macro
' Opens with File
' ********************
Sub Auto_Open()
Application.Toolbars("Titles").Visible = True
Application.Toolbars("Titles").Top = 0
Application.Toolbars("Titles").Left = 0
Application.Toolbars("Titles").ToolbarButtons(1).O nAction =

"SetTitles"
Application.Toolbars("Titles").ToolbarButtons(2).O nAction =

"DelTitles"
End Sub
'
'
'
'
'
' ********************
' Auto_Close Macro
' Closes with File
' ********************
Sub Auto_Close()
Application.Toolbars("Titles").Visible = False
Application.Toolbars("Fee").Visible = False
Application.Toolbars("Hide_Unhide").Visible = False
End Sub


I tried the following and VBA gives an error on the fourth line stating
Method or data member not found.

Private Sub Workbook_Open()
Application.CommandBars("Titles").Visible = True
Application.CommandBars("Titles").Top = 0
Application.CommandBars("Titles").Left = 0
Application.CommandBars("Titles").CommandBarButton (1).OnAction =
"SetTitles"
Application.CommandBars("Titles").CommandBarButton (2).OnAction =
"DelTitles"
End Sub
'
'
'
'
' ********************
' Closes Toolbars
'
' ********************
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.Toolbars("Titles").Visible = False
Application.Toolbars("Fee").Visible = False
Application.Toolbars("Hide_Unhide").Visible = False
End Sub




--
ksn



  #3   Report Post  
Posted to microsoft.public.excel.programming
ksn ksn is offline
external usenet poster
 
Posts: 7
Default Code Error

Thanks Tom. I do not do enough programming to remain on top of all of this.
--
ksn


"Tom Ogilvy" wrote:

Private Sub Workbook_Open()
Application.CommandBars("Titles").Visible = True
Application.CommandBars("Titles").Top = 0
Application.CommandBars("Titles").Left = 0
Application.CommandBars("Titles").Controls(1).OnAc tion = _
"SetTitles"
Application.CommandBars("Titles").Controls.OnActio n = _
"DelTitles"
End Sub

--
Regards,
Tom Ogilvy


"ksn" wrote in message
...
This was old code from Excel 95 and I want to convert this to the latest.
Basically this macro pulls up a custom toolbar with an assigned macro to

run
on action.

'
'
'
'
'
' ********************
' Auto_Open Macro
' Opens with File
' ********************
Sub Auto_Open()
Application.Toolbars("Titles").Visible = True
Application.Toolbars("Titles").Top = 0
Application.Toolbars("Titles").Left = 0
Application.Toolbars("Titles").ToolbarButtons(1).O nAction =

"SetTitles"
Application.Toolbars("Titles").ToolbarButtons(2).O nAction =

"DelTitles"
End Sub
'
'
'
'
'
' ********************
' Auto_Close Macro
' Closes with File
' ********************
Sub Auto_Close()
Application.Toolbars("Titles").Visible = False
Application.Toolbars("Fee").Visible = False
Application.Toolbars("Hide_Unhide").Visible = False
End Sub


I tried the following and VBA gives an error on the fourth line stating
Method or data member not found.

Private Sub Workbook_Open()
Application.CommandBars("Titles").Visible = True
Application.CommandBars("Titles").Top = 0
Application.CommandBars("Titles").Left = 0
Application.CommandBars("Titles").CommandBarButton (1).OnAction =
"SetTitles"
Application.CommandBars("Titles").CommandBarButton (2).OnAction =
"DelTitles"
End Sub
'
'
'
'
' ********************
' Closes Toolbars
'
' ********************
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.Toolbars("Titles").Visible = False
Application.Toolbars("Fee").Visible = False
Application.Toolbars("Hide_Unhide").Visible = False
End Sub




--
ksn




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Code Error

typo on that last line

Application.CommandBars("Titles").Controls.OnActio n = _
"DelTitles"

should be

Application.CommandBars("Titles").Controls(2).OnAc tion = _
"DelTitles"

--
Regards,
Tom Ogilvy

"ksn" wrote in message
...
Thanks Tom. I do not do enough programming to remain on top of all of

this.
--
ksn


"Tom Ogilvy" wrote:

Private Sub Workbook_Open()
Application.CommandBars("Titles").Visible = True
Application.CommandBars("Titles").Top = 0
Application.CommandBars("Titles").Left = 0
Application.CommandBars("Titles").Controls(1).OnAc tion = _
"SetTitles"
Application.CommandBars("Titles").Controls.OnActio n = _
"DelTitles"
End Sub

--
Regards,
Tom Ogilvy


"ksn" wrote in message
...
This was old code from Excel 95 and I want to convert this to the

latest.
Basically this macro pulls up a custom toolbar with an assigned macro

to
run
on action.

'
'
'
'
'
' ********************
' Auto_Open Macro
' Opens with File
' ********************
Sub Auto_Open()
Application.Toolbars("Titles").Visible = True
Application.Toolbars("Titles").Top = 0
Application.Toolbars("Titles").Left = 0
Application.Toolbars("Titles").ToolbarButtons(1).O nAction =

"SetTitles"
Application.Toolbars("Titles").ToolbarButtons(2).O nAction =

"DelTitles"
End Sub
'
'
'
'
'
' ********************
' Auto_Close Macro
' Closes with File
' ********************
Sub Auto_Close()
Application.Toolbars("Titles").Visible = False
Application.Toolbars("Fee").Visible = False
Application.Toolbars("Hide_Unhide").Visible = False
End Sub


I tried the following and VBA gives an error on the fourth line

stating
Method or data member not found.

Private Sub Workbook_Open()
Application.CommandBars("Titles").Visible = True
Application.CommandBars("Titles").Top = 0
Application.CommandBars("Titles").Left = 0
Application.CommandBars("Titles").CommandBarButton (1).OnAction =
"SetTitles"
Application.CommandBars("Titles").CommandBarButton (2).OnAction =
"DelTitles"
End Sub
'
'
'
'
' ********************
' Closes Toolbars
'
' ********************
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.Toolbars("Titles").Visible = False
Application.Toolbars("Fee").Visible = False
Application.Toolbars("Hide_Unhide").Visible = False
End Sub




--
ksn






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
Code error M&M[_2_] Excel Discussion (Misc queries) 4 July 13th 07 12:20 AM
Error in Code Jim May Excel Programming 6 May 9th 05 01:37 PM
Code error gavmer[_39_] Excel Programming 4 June 25th 04 03:34 AM
How can I still go to the error-code after a On Error Goto? Michel[_3_] Excel Programming 2 May 4th 04 04:21 AM
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) Tim[_36_] Excel Programming 4 April 23rd 04 02:53 AM


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