rtinaro
10-10-2012, 05:38 PM
Hello all and thank you in advance for any help.
I've been creating macros to help me make math tests and worksheets (I am a HS math teacher). I am trying to learn the code for inserting a textbox or shape near the cursor in a word document. The macro I have for inserting a text box is
Dim Shp As Shape
Set Shp = ActiveDocument.Shapes.AddTextbox( _
Orientation:=msoTextOrientationHorizontal, _
Left:=120, Top:=120, Width:=288, Height:=72)
Shp.TextFrame.TextRange.InsertSymbol Font:="+Body", CharacterNumber:=9679, Unicode:=True
Shp.line.Visible = msoFalse
Shp.Fill.Visible = msoFalse
Shp.Width = 36#
Shp.Height = 36#
Set Shp = Nothing
I know the AddTextbox(_Orientation...) code determines where the textbox is inserted, and I have tried to find code that would place the text box on the current page or at the cursor. I've had no luck, and I would appreciate any advice.
I have seen some code that uses "InsertAfter," but I couldn't get anything to work. Thanks again for any help.
I've been creating macros to help me make math tests and worksheets (I am a HS math teacher). I am trying to learn the code for inserting a textbox or shape near the cursor in a word document. The macro I have for inserting a text box is
Dim Shp As Shape
Set Shp = ActiveDocument.Shapes.AddTextbox( _
Orientation:=msoTextOrientationHorizontal, _
Left:=120, Top:=120, Width:=288, Height:=72)
Shp.TextFrame.TextRange.InsertSymbol Font:="+Body", CharacterNumber:=9679, Unicode:=True
Shp.line.Visible = msoFalse
Shp.Fill.Visible = msoFalse
Shp.Width = 36#
Shp.Height = 36#
Set Shp = Nothing
I know the AddTextbox(_Orientation...) code determines where the textbox is inserted, and I have tried to find code that would place the text box on the current page or at the cursor. I've had no luck, and I would appreciate any advice.
I have seen some code that uses "InsertAfter," but I couldn't get anything to work. Thanks again for any help.