Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2005

Tip: Looking for answers? Try searching our database.

Parameter passing to MSWord macros

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jay - 31 Dec 2004 07:08 GMT
Is it possible to pass a parameter to a macro in  a right-click pop-up
menu button click?
commandbarbutton.onAction..

For instance..

Dim ct3_PopUp as CommandBarButton
Dim parameter as string, tmp as string, tmp1 as string

With ct3_PopUp
                    .caption = ...
                    tmp = "(" & parameter & ")"
                    tmp1 = "macro1" & tmp
                    .OnAction = tmp1
End With

Public Sub macro1(desc as string)
   MsgBox desc
End Sub
Helmut Weber - 31 Dec 2004 12:38 GMT
Hi Jay,

>in a right-click pop-up menu button click?

I may be on an entirely wrong track,
but if I right-click in the menu bar,
I get a list of the available icon bars.

If you like, you can add a sub-menu or an additional icon bar.
But I'd rather make it accessible directly
by adding such a menu or an icon bar to the existing
menu bar or to an existing icon bar,
containing smallest possible macros
like "Macro001", "Macro002", "Macro003", connected to
a bigger macro and pass whatever parameters you like to it.
Be it defined in the smaller macros or be it defined
by a range, the selection, or whatever data are availabe.

Commandbarbutton.onAction seems to be only useful,
if you add Commandbarbuttons dynamically.

I wonder...

Sub Test001()
  BigMacro "001"
End Sub
Sub Test002()
OnAction
  BigMacro "002"
End Sub
Sub Test003()
  BigMacro "003"
End Sub
Sub BigMacro(aStr As String)
  MsgBox aStr
  Application.CommandBars("NewMenu").Visible = False
End Sub

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
Krithika Jaysree - 24 Jan 2005 11:47 GMT
Thanks for the reply
The reply would have been a good solution to us, had we known the number of items in our menu.
The number of items in the sub-menu is dynamic. so in this case we cannot hard code the parameters in the small macros. is there any other means to pass the arguments directly?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.