#1
|
|||
|
|||
Sub Auto_Open() runs but doesn't always work
I have the following subroutine
VBAProject (PERSONAL.xlsb) Modules Module1 Sub Auto_Open() Dim Shortcut As CommandBar Caption = "Insert C Comment" End With which should add a new item to the right click/context menu titled "Insert C Comment", which when clicked, calls the subroutine AddComment() (also stored in Module1).End Sub If I run the routine with Excel already open, everything works as expected. However, if I initially open Excel, my understanding is that a subroutine named Auto_Open stored as above should run automatically. And indeed it does, as evidenced by the test MsgBox being displayed. However recently even though the subroutine runs, "Insert C Comment" is *not* added to the context menu. Some time ago it was inserted ok, and later it was inserted twice(!), but now it's not inserted at all. Any ideas as to what's going on? |
#2
|
|||
|
|||
The subroutine should read
...that is, with "." before Caption & OnAction. (My actual subroutine has it correct.) (Is there a way for the original poster to edit his post, rather than have to "reply" to it as I've done?) [Note added later: I see I'm able to edit this reply, but not my original post. Don't understand why.] Last edited by coffent; 05-09-2021 at 09:24 AM. Reason: Add info. |
#3
|
|||
|
|||
The problem has become moot. I'd like to delete the question entirely but can't find how to do it.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
VBA script runs once but if I try to run it again, it does not work | jakecahill | Excel Programming | 3 | 07-11-2017 07:32 AM |
VBA runs I then save as to keep master free from editds but does not work | dingar | Word VBA | 3 | 04-27-2017 03:18 PM |
SHIFT+END doesn't work | derohanes | Excel | 2 | 09-28-2015 09:31 AM |
HelpViewer doesn't work | dherr | Office | 1 | 03-27-2015 07:44 AM |
alt+numeric doesn't work | Kungen | Word | 3 | 12-02-2011 11:25 AM |