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 / December 2004

Tip: Looking for answers? Try searching our database.

is it possible to build "onAction" for dynamic menu items with par

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marlow Stevens - 14 Dec 2004 19:17 GMT
Using a word template which has a custom Menu File item, menu items are
dynamically inserted via automation.  

HOWEVER the onAction needs to pass a param to it's handler.....can this be
done?

Basically, is there a way that Word can associate N number of onActions
calls  to the same actionHandler but with an index parameter?

For instance.
add (button1, onAction='handleSelection(1)')
add (button2, onAction='handleSelection(2)')
. . .
add (buttonN, onAction='handleSelection(N)')

. . .
sub handleSelection(n as integer)
  switch(n)
    . . .

Thanks in advance.
Jezebel - 14 Dec 2004 20:34 GMT
You can use the control's Tag and Parameter properties to attach additional
information to the control. When a control is clicked, the
CommandBars.ActionControl property gives you a reference to the control that
was used.

           Set pButton = .Controls.Add(Type:=msoControlButton)
           With pButton
               .Caption = "Action " & pIndex
               .Enabled = false
               .OnAction = "HandleSelection"
               .Style = msoButtonCaption
               .Tag = 1
               .TooltipText = "Action #" & pIndex
               .Visible = true
           End With

Public Sub HandleSelection

   Select Case CommandBars.ActionControl.Tag
   Case 1
       .....

etc

> Using a word template which has a custom Menu File item, menu items are
> dynamically inserted via automation.
[quoted text clipped - 17 lines]
>
> Thanks in advance.
 
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.