Returning Option Button name

K

Kamran

I'm a novice at this. How can I store the name of a shape in a variable in
Word 2003? What I have is this, and it's not working:

Dim shapePos As Variant
shapePos = ActiveDocument.Shapes(1).Name

I want to store this name because the macro I'm going to run after is going
to move the cursor to another place in the document. I'm want the focus to
return to where it was when they clicked the button. So I also need to know
to go to a particular Option Button that was created using the Control
Toolbar.
Thanks.
 
S

Shasur

Hi

Can you try

ActiveDocument.InlineShapes(1).OLEFormat.Object.name

or

ActiveDocument.Shapes(1).OLEFormat.Object.name
 
K

Kamran

Thanks for the reply. I'm still having some trouble with this. Here's the
code I've got:

Private Sub OptionButton1_Click()

Dim fld As Variant
Dim shapePos As Shape
Set shapePos = ActiveDocument.Shapes(1).OLEFormat.Object

Application.ScreenUpdating = False

Selection.GoTo what:=wdGoToBookmark, Name:="Table_cLTV1"
Selection.NextField

For fld = 1 To 44
Selection.FormFields(1).Enabled = True
Selection.NextField
Next fld

Application.ScreenUpdating = True
shapePos.SetFocus

End Sub

===========

So what I want it to do, after going to the table, disabling all the
FORMTEXT fields in it, is return the focus to OptionButton1, so that the user
doesn't have to manually scroll back to where they were.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top