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.

Re: Is it possible to add a click event to a Word label? by Doug

Doug
Tue May 20 12:51:57 PDT 2008

Use a MacroButton field (Insert>Text>Quick Parts>Field)

--
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

"Roman Benko" <RomanBenko@discussions.microsoft.com> wrote in message
news:6E87D9D9-E3F6-4A68-A58D-A2498AA0F5C4@microsoft.com...
>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.
>
>
>