Shrout1
07-20-2011, 10:40 AM
Back with more textbox questions!
I want to get the document "Line Number" beneath where my text box resides. The text boxes are being used as metadata tags to help navigate a document.
I want to be able to cull the text directly next to the textbox in order to display the first sentence on the userform. This will give the reader some context about the data tag.
Here is the code I use to create the textbox:
Private Sub cmdAddTag_Click()
Dim x As Single
Dim y As Single
Dim CS As Shape
x = Selection.Information(wdHorizontalPositionRelativeToPage)
y = Selection.Information(wdVerticalPositionRelativeToPage)
Set CS = ActiveDocument.Shapes.AddTextbox( _
msoTextOrientationHorizontal, x, y, _
1, 1)
CS.Select
CS.Height = 0
CS.Width = 0
'Available Tags are generated on userform activate and loaded into a list
Selection.Text = frmMetadata.listAvailableTags.Text & ", metataginfo"
Update_Existing_Tags
End Sub
How do I reverse this and derive the line value of the textbox? As the tags might be moved I need to generate the location of the textbox each time the macro is run. Lots of info on how to position the textbox, but not how to return the textbox position. Any help is appreciated!
I want to get the document "Line Number" beneath where my text box resides. The text boxes are being used as metadata tags to help navigate a document.
I want to be able to cull the text directly next to the textbox in order to display the first sentence on the userform. This will give the reader some context about the data tag.
Here is the code I use to create the textbox:
Private Sub cmdAddTag_Click()
Dim x As Single
Dim y As Single
Dim CS As Shape
x = Selection.Information(wdHorizontalPositionRelativeToPage)
y = Selection.Information(wdVerticalPositionRelativeToPage)
Set CS = ActiveDocument.Shapes.AddTextbox( _
msoTextOrientationHorizontal, x, y, _
1, 1)
CS.Select
CS.Height = 0
CS.Width = 0
'Available Tags are generated on userform activate and loaded into a list
Selection.Text = frmMetadata.listAvailableTags.Text & ", metataginfo"
Update_Existing_Tags
End Sub
How do I reverse this and derive the line value of the textbox? As the tags might be moved I need to generate the location of the textbox each time the macro is run. Lots of info on how to position the textbox, but not how to return the textbox position. Any help is appreciated!