PDA

View Full Version : Solved: Word automation Runtime error 5917



Movian
10-17-2008, 09:14 AM
Hey,
im producing an automated diagram and want to insert multiple text boxes with the letter P at specific locations. I am currently using the following code

If Me.RPerf1 = True Or Me.Lperf1 = True Then
.ActiveDocument.Shapes.AddTextbox(1, 312, 290, 9, 12).select
.Selection.ShapeRange.TextFrame.MarginBottom = 0
.Selection.ShapeRange.TextFrame.MarginLeft = 0.5
.Selection.ShapeRange.TextFrame.MarginRight = 0
.Selection.ShapeRange.TextFrame.MarginTop = 0
.Selection.ShapeRange.TextFrame.TextRange = "P"
.Selection.ShapeRange.LockAnchor = True
If Me.RPerf1 = True Then
.ActiveDocument.Shapes.AddLine(312, 290, 298, 310).select
.Selection.ShapeRange.Line.EndArrowheadStyle = 2
.Selection.ShapeRange.LockAnchor = True
End If
If Me.Lperf1 = True Then
.ActiveDocument.Shapes.AddLine(321, 290, 340, 310).select
.Selection.ShapeRange.Line.EndArrowheadStyle = 2
.Selection.ShapeRange.LockAnchor = True
End If
End If

'Proximal Calf
If Me.Rperf2 = True Or Me.Lperf2 = True Then
.ActiveDocument.Shapes.AddTextbox(1, 312, 330, 9, 12).select
.Selection.ShapeRange.TextFrame.MarginBottom = 0
.Selection.ShapeRange.TextFrame.MarginLeft = 0.5
.Selection.ShapeRange.TextFrame.MarginRight = 0
.Selection.ShapeRange.TextFrame.MarginTop = 0
.Selection.ShapeRange.TextFrame.TextRange = "P"
.Selection.ShapeRange.LockAnchor = True
If Me.Rperf2 = True Then
.ActiveDocument.Shapes.AddLine(312, 330, 298, 350).select
.Selection.ShapeRange.Line.EndArrowheadStyle = 2
.Selection.ShapeRange.LockAnchor = True
End If
If Me.Lperf2 = True Then
.ActiveDocument.Shapes.AddLine(321, 330, 340, 350).select
.Selection.ShapeRange.Line.EndArrowheadStyle = 2
.Selection.ShapeRange.LockAnchor = True
End If
End If
now if i use either of these sections on their own, it works fine. However as soon as i try and put BOTH of these text boxes in i get the following error

Runtime error 5917

This object does not support the attached text

Now as it works when i create just one textbox i know that this is a lie :P
however im presuming what it really means is that it is giving it the same name or somthing similar. however i was unable to find a naming option to try to resolve this....


Suggestions ?

Movian
10-20-2008, 08:28 AM
I fixed this by creating images of the Letter P with a circle around them and then inserting the images instead of attempting to create text boxes.