Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Code error | Excel Discussion (Misc queries) | |||
Error in Code | Excel Programming | |||
Code error | Excel Programming | |||
How can I still go to the error-code after a On Error Goto? | Excel Programming | |||
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) | Excel Programming |