Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the following code in ThisWorkbook module of Personal.xls:
Private Sub Workbook_Open() 'Sub Auto_Open () Dim NewControl As CommandBarControl ' Assign shortcut to Insert Today on SHIFT+CTRL+D Application.OnKey "+^{D}", "Module2.Insert_Date" ' Add item to shortcut menu on open On Error Resume Next Application.CommandBars("Cell").Controls("Insert Date").Delete On Error GoTo 0 Set NewControl = Application.CommandBars("Cell").Controls.Add With NewControl .Caption = "Insert Date" .OnAction = "Module2.Insert_Date" .BeginGroup = True End With ' Assign shortcut to display Calendar Date on SHIFT+CTRL+C Application.OnKey "+^{C}", "Module11.OpenCalendar" ' Add item to shortcut menu on open On Error Resume Next Application.CommandBars("Cell").Controls("Calendar Date").Delete On Error GoTo 0 Set NewControl = Application.CommandBars("Cell").Controls.Add With NewControl .Caption = "Calendar Date" .OnAction = "Module11.OpenCalendar" .BeginGroup = False End With End Sub Adapted from Martin Green web page www.fontstuff.com, however it doesn't seem to matter whether it is Private Sub Workbook_Open() or Sub Auto_Open () it doesn't run when Excel starts up. However in either case if I Run Sub/UserForm from within VBE it works quite happily. Personal.xls appears to be loading Ok as it is visible in the VBE and I can run other macros that are contained with it from Tools, Macros. There are no other Auto_Open or Workbook_Open modules. I have tried putting Sub Auto_Open() as a module but still no luck Any Suggestions? Many Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Private Sub Workbook_Open() doesn't run | Excel Discussion (Misc queries) | |||
Private Sub Workbook_Open() not running on open | Excel Programming | |||
Auto_Open and Workbook_Open | Excel Programming | |||
Auto_Open and Workbook_Open in Addins | Excel Programming | |||
Auto_Open Vs Workbook_open | Excel Programming |