Public Sub not recognizing IRibbonControl (1 Viewer)

tmedzyk

New member
Local time
Today, 05:39
Joined
Mar 8, 2012
Messages
7
I am trying to code a Custom Ribbon Button's OnAction. When I create the Public Sub in my module the drop down list does not include IRibbon. I know I need to add "Control As IRibbonControl" to the () after my Public Sub "NameOfPublicSub()". As I type it in, when I finish the "As" it gives a drop down list but IRibbon is not in it. The IRibbonControl does not capitalize and change color and when I try to run it I get the error that the callback does not exist.

What am I doing wrong? Is there a reference I don't have selected? Why isn't it working?
 

cjohnson78

Registered User.
Local time
Today, 05:39
Joined
Mar 29, 2012
Messages
11
Maybe it has something to do with your object library? I'm guessing. Just trying to help.
 

NigelShaw

Registered User.
Local time
Today, 13:39
Joined
Jan 11, 2008
Messages
1,573
Hi

Are you declaring IRibbon as a control? This should be a public variable. I don't have the link to hand as I'm on my iPad but if you search my threads, I have a very detailed tutorial for ribbon with the vba that's required.


Cheers
 

tmedzyk

New member
Local time
Today, 05:39
Joined
Mar 8, 2012
Messages
7
I researched a little more and found that IRibbon is part of the Microsoft Office 14.0 Object Library. I had it checked in the references, but it wasn't functioning. I found a posting that said sometimes you can uncheck a library reference, close the database, re-check it and it will start working.

What do you know .... it worked. Whew! That was so frustrating!
 

cjohnson78

Registered User.
Local time
Today, 05:39
Joined
Mar 29, 2012
Messages
11
So I was right? It was an object library issue? What a lucky guess. haha
 

tmedzyk

New member
Local time
Today, 05:39
Joined
Mar 8, 2012
Messages
7
No guess, you are brilliant! Thank you.

I really do appreciate you and everyone else who answers these cries for help. Sometimes just pointing in the right directions gets us there.

THANK YOU!
 

cjohnson78

Registered User.
Local time
Today, 05:39
Joined
Mar 29, 2012
Messages
11
No problem. Glad to help. I think I may have hurt myself patting myself on the back though. haha
 

Tarequ Lateef

New member
Local time
Today, 15:39
Joined
May 11, 2016
Messages
1
Before writing any callback code for Access ribbon controls, you must reference the Microsoft
Office 14.0 Object Library in the References dialog box (select Tools ➪ References, and select the
check box next to Microsoft Office 14.0 Object Library)
 

Users who are viewing this thread

Top Bottom