Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-14-2015, 11:18 AM
gmaxey gmaxey is offline Pass Arguments to Function Through Ribbon Windows 7 32bit Pass Arguments to Function Through Ribbon Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,602
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default


What is your question? How much effort do you expect people to devote to your issue based on the effort that you made to define it?
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #2  
Old 03-14-2015, 04:40 PM
inagalaxyfarfarawry inagalaxyfarfarawry is offline Pass Arguments to Function Through Ribbon Windows 8 Pass Arguments to Function Through Ribbon Office 2013
Novice
Pass Arguments to Function Through Ribbon
 
Join Date: Mar 2015
Posts: 8
inagalaxyfarfarawry is on a distinguished road
Default

Not exactly sure how you're missing the question. My problem is defined above...twice, I might add, since it looked like this site hadn't taken it the first time. How much more do you want?

Quote:
Originally Posted by inagalaxyfarfarawry View Post
But how do I pass the function an argument through Word's ribbon?
Quote:
Originally Posted by inagalaxyfarfarawry View Post
Is there a way to do this in MS Word 2010?
Reply With Quote
  #3  
Old 03-14-2015, 05:04 PM
gmaxey gmaxey is offline Pass Arguments to Function Through Ribbon Windows 7 32bit Pass Arguments to Function Through Ribbon Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,602
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

There was nothing above my post when I replied earlier. Just the thread title.

I'm assuming you have a common button OnAction macro defined in your RibbonX and a Button OnAction macro something like the following in your VBA project:

Code:
Sub ButtonOnAction(control As IRibbonControl)
Dim pCall As String
Select Case control.ID
  Case "Btn1", "Btn2", "Btn3", "Btn4" '... etc.
     modMain.DoSomethingWithThisButton control.Tag 'Use the control tag property to define a variable argument.
  Case Else
    'Do Nothing
End Select
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #4  
Old 03-14-2015, 09:21 PM
inagalaxyfarfarawry inagalaxyfarfarawry is offline Pass Arguments to Function Through Ribbon Windows 8 Pass Arguments to Function Through Ribbon Office 2013
Novice
Pass Arguments to Function Through Ribbon
 
Join Date: Mar 2015
Posts: 8
inagalaxyfarfarawry is on a distinguished road
Default

Not sure why there was nothing there. I even accidentally posted it twice in the same thread.

This is the first I've heard about iRibbonControl. I have to confess to being a VB rookie, and programming is not my forte to boot. I've always found programming waaaaay more confusing than other people have.

I put your code into my VB, but I'm not sure how to call ButtonOnAction because I don't know what argument to put in the calling sub. I get the error message "ByRef argument type mismatch." I know I'm putting an object type as the argument instead of an instance, but I don't know how to reference iRibbonControl; if it's supposed to be something VB is passing, shouldn't it already have a name? I have to admit I've Googled Object.ID, System.ID, Application (which returns, simply, "Microsoft Word"), Office.ribbonUI, ByVals, examples, everything, and I'm more lost than when I started. Shouldn't this be as easy as assigning test(1) to a ribbon button instead of just test and having to go through all these programming gymnastics just to do something so simple?

sub test()
call ButtonOnAction(iRibbonControl)
end sub
Reply With Quote
Reply

Tags
macro, microsoft word 2010, ribbon

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pass Arguments to Function Through Ribbon How to Pass Arguments in a Formula? tinfanide Excel Programming 2 10-13-2014 06:10 AM
Pass Arguments to Function Through Ribbon How to Pass Document to this Sub ilcaa72 Word VBA 1 01-28-2014 03:04 PM
How to import the customized ribbon to Word without overwriting the existing Ribbon? SharonSh Word VBA 0 09-26-2013 11:47 PM
How to pass parameters to a .msg file? HereNow Outlook 0 11-05-2012 10:38 AM
Excel 2010 Ribbon look like 2007's Ribbon esotop Excel 0 03-22-2011 07:05 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:39 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft