Consulting

Results 1 to 2 of 2

Thread: Solved: Word automation Runtime error 5917

  1. #1
    VBAX Mentor Movian's Avatar
    Joined
    Aug 2008
    Location
    NC, USA
    Posts
    399

    Solved: Word automation Runtime error 5917

    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

    [vba]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[/vba]
    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 ?
    Last edited by Movian; 10-17-2008 at 09:31 AM.
    "From the ashes of disaster grow the roses of success" - Chitty chitty bang bang

    "I fear not the man who has 10,000 kicks practiced once. I fear the man who has 1 kick practiced 10,000 times" - Bruce Lee

  2. #2
    VBAX Mentor Movian's Avatar
    Joined
    Aug 2008
    Location
    NC, USA
    Posts
    399
    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.
    "From the ashes of disaster grow the roses of success" - Chitty chitty bang bang

    "I fear not the man who has 10,000 kicks practiced once. I fear the man who has 1 kick practiced 10,000 times" - Bruce Lee

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •