Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Cannot get Auto_Open or Private Sub Workbook_Open() to run at star

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
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
Private Sub Workbook_Open() doesn't run Steve Starr Excel Discussion (Misc queries) 4 April 3rd 11 05:05 AM
Private Sub Workbook_Open() not running on open Tim[_39_] Excel Programming 0 August 30th 04 09:11 PM
Auto_Open and Workbook_Open Erich Neuwirth Excel Programming 1 July 14th 04 01:19 AM
Auto_Open and Workbook_Open in Addins Erich Neuwirth Excel Programming 1 July 11th 04 06:54 PM
Auto_Open Vs Workbook_open Soniya Excel Programming 2 September 23rd 03 03:56 PM


All times are GMT +1. The time now is 07:02 PM.

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"