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 / May 2008

Tip: Looking for answers? Try searching our database.

Is it possible to add a click event to a Word label?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Roman Benko - 20 May 2008 13:49 GMT
I am working with Word 2007 and Visual Studio 2008

In Excel I can add a label to the active worksheet and assign code to run if
the user clicks on the label (see below).  I can use similar code to add a
label to a Word document, but I can't see how to add code to run if the user
clicks on the label.  There is no OnAction property to set.  Can someone
explain how to add a code handler if the user clicks on a label in a Word
document?    Thanks.



'EXCEL:

Dim label As Microsoft.Office.Interop.Excel.Shape
label =
Globals.ThisWorkbook.ActiveSheet.Shapes.AddLabel(msoTextOrientationHorizontal, 30, 30, 140, 15)

label.OnAction = "myLabelClickCode"

 

'WORD:
Dim label As Microsoft.Office.Interop.Word.Shape

label = Globals.ThisDocument.Shapes.AddLabel(msoTextOrientationHorizontal,
10, 10, 30, 15)

'there is no label.OnAction property available to set.
Doug Robbins - Word MVP - 20 May 2008 20:51 GMT
Use a MacroButton field (Insert>Text>Quick Parts>Field)

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

>I am working with Word 2007 and Visual Studio 2008
>
[quoted text clipped - 23 lines]
>
> 'there is no label.OnAction property available to set.
 
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.