Customize VBA Icon Menu (1 Viewer)

Privateer

Registered User.
Local time
Today, 07:05
Joined
Aug 16, 2011
Messages
193
I would like to add an icon to the VBA icon menu, not the Access menu, that can execute a specific procedure. I was able to drag the Macro... "command" to the icon menu but that just gets me the list of procedures. I then have to locate the procedure I want and click on it. It's better than nothing, but not what I was hoping for. This was very easy in the fabrication side of Access, I created a macro and assigned it to an icon, and it just executes the macro every time I click on it. Can this be done on the coding side to the VBA menu? The reason for this that I found code that wipes out everything in the immediate window and I would prefer to have this as an icon rather than add it to the form's code. Thanks in advance for any help you might have.
 

jdraw

Super Moderator
Staff member
Local time
Today, 07:05
Joined
Jan 23, 2006
Messages
15,379
This approach may help. You'll have to sort out how to invoke from an icon.
Functional but not pretty.
Code:
Sub clearImmediate()
Debug.Print String(65535, vbCr)
End Sub
 

Privateer

Registered User.
Local time
Today, 07:05
Joined
Aug 16, 2011
Messages
193
Thank you for the code, it's a good, clean alternative. When I tested it, I noticed it leaves the cursor at the last location, which could be ten or twenty rows down, not a big deal, just different. The code I found really wipes out the contents of the window and puts the cursor on row one, no elevator.
Since I test most of my code by clicking on command buttons, I decided to execute the procedure from the quick access tool bar via a macro. Thanks again.

Code:
Call DoCmd.RunCommand(acCmdDebugWindow)

SendKeys ("^a{DEL}")
 

KitaYama

Well-known member
Local time
Today, 20:05
Joined
Jan 6, 2022
Messages
1,540
It's not the answer to your problem. It's simply what I've done.

I needed to add several buttons to VBE toolbars and run specific functions. But unfortunately it was impossible.
So I added several combo boxes to Access (not VBE) ribbon. They contain the name of all forms, tables, reports or specific functions and procedures. When I need any of them, I simply select them from the combo box.


3.jpg


Code:
Action = Nz(GetThisField("tblRibbonCallbacks", "RibbonID='" & control.ID & "'", "rbnOnAction"), "")
 
If Not IsNothing(Action) Then
    Run (Action)
Else
    FormattedMsgBox Action, "Function not defined."
End If
 

D_Walla

Member
Local time
Today, 12:05
Joined
Aug 1, 2021
Messages
32
Please forgive me - I'm not experienced in Access VBA (I work mostly with Excel VBA/Outlook VBA), but I would have thought that you could add controls to the VBIDE (the VBA side) through using the Microsoft VBA Extensibility 5.3 library?
 

Users who are viewing this thread

Top Bottom