UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Create Custom Right Click Menu...., Any Version    
 
   
jimbofoxman
post Oct 10 2019, 09:50 AM
Post#1



Posts: 388
Joined: 4-April 08



I use to have a custom right click menu in one of my databases that all it had was Copy, Cut, Paste for those users to who never learned the equivalent windows commands (SIGH). The other day I created a blank database and imported everything from this database which seemed to have killed the right click menu and for the life of me I cannot remember what the heck I did years ago to create it.

I found this code, but I get a compile error "User-defined type not defined" which based on the article I found, it says it needs to have the "Microsoft Office 15.0 Access database engine object". Since I am in 2016, I don't have that. I think the problem would be that we are still a mixed environment of 2010, 2013 and 2016. (Yeah I probably should be running the 2016 runtime on all the machines)

CODE
Sub CreateCopyPasteShortcutMenu()
    Dim CopyPasteShortcutMenu As Office.CommandBar

    ' Create a shortcut menu named "MyShortcutMenu.
    Set cmbShortcutMenu = CommandBars.Add("CopyPasteShortcutMenu", msoBarPopup, False, True)

    'Add the cut command
    cmbShortcutMenu.Controls.Add Type:=msoControlButton, Id:=21

    ' Add the copy command.
    cmbShortcutMenu.Controls.Add Type:=msoControlButton, Id:=19

    ' Add the paste command.
    cmbShortcutMenu.Controls.Add Type:=msoControlButton, Id:=22

    Set cmbShortcutMenu = Nothing

End Sub


In the past I must of run something similar as in the Current Database Options I had Shortcut Menu Bar set to this Shortcut menu I had originally created. I'm kinda stumped on what to do. Even if I could just have it on one form, that would be all I need (at this point at least)
Go to the top of the page
 
theDBguy
post Oct 10 2019, 09:55 AM
Post#2


Access Wiki and Forums Moderator
Posts: 76,379
Joined: 19-June 07
From: SunnySandyEggo


Hi. When you import your db objects, you could go to options and make sure to include other stuff. Or, you could recreate the shortcut menu using VBA or macro. Try fixing your references and then try the code again.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
jimbofoxman
post Oct 10 2019, 10:34 AM
Post#3



Posts: 388
Joined: 4-April 08



Went back and imported the form I was working on, selected the options button, then checked Menus/Toolbars. Silly me, I have never touched the option button ever! dunce.gif Now I have that shortcut menu back as an option.

With the Reference thing, would i just have to copy the correct reference from one of the 2010 machines? I don't even have the option for 14.0 or 15.0 in my list of options.

Thanks again for the assistance theDBGuy!
Go to the top of the page
 
arnelgp
post Oct 10 2019, 10:37 AM
Post#4



Posts: 1,424
Joined: 2-April 09
From: somewhere out there...


add Reference to Microsoft Office XX.X Object Library.

--------------------
Never stop learning, because life never stops teaching.
Go to the top of the page
 
theDBguy
post Oct 10 2019, 10:50 AM
Post#5


Access Wiki and Forums Moderator
Posts: 76,379
Joined: 19-June 07
From: SunnySandyEggo


Hi. Glad to hear you got it sorted out. For the reference, you simply use whatever is available on the machine you're currently using. Cheers!

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
jimbofoxman
post Oct 10 2019, 11:41 AM
Post#6



Posts: 388
Joined: 4-April 08



So I do have 16, and it is selected. But it gives me the User Defined error on "Dim CopyPasteShortcutMenu As Office.CommandBar"

But since I have it working anyway, guess it is mute at this point.

Side note: I did find in my searches today this Access Shortcut tool, which now that I've restored my Context Menu it does show up in this Shortcut Tool and you can make changes to it. Just loaded it, so haven't really played with it too much.

http://dev-soln.com/access-shortcut-right-click-tool/
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    15th October 2019 - 04:08 AM