• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1125
  • Last Modified:

MS Word 2010 - Convert Text Boxes + Autoshapes to Text

Need a MS Word 2010 macro that

1, selects all text boxes and autoshapes
2. converts the text inside to regular text

I expect that the text will end up rather scrambled, but that is ok.
0
cmd407
Asked:
cmd407
  • 6
  • 3
1 Solution
 
Rgonzo1971Commented:
Hi,

pls try

Sub ConvertTextBoxes()

For Each oShape In ActiveDocument.Shapes
    If oShape.TextFrame.HasText = True Then
        oShape.Select
        
        strText = oShape.TextFrame.TextRange.Text
        oShape.ConvertToInlineShape
        oShape.Delete
        Selection.TypeText strText
    End If
Next

End Sub

Open in new window

Regards
0
 
cmd407Author Commented:
It sticks on line 8:
 oShape.ConvertToInlineShape
0
 
Rgonzo1971Commented:
Let's try without
Sub ConvertTextBoxes()

For Each oShape In ActiveDocument.Shapes
    If oShape.TextFrame.HasText = True Then
        oShape.Select
        
        strText = oShape.TextFrame.TextRange.Text
        oShape.Delete
        Selection.TypeText strText
    End If
Next

End Sub

Open in new window

0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
cmd407Author Commented:
I have 9 text boxes arranged vertically and numbered by the text inside.  Your macro  converted these boxes 1,3,5,7,9 with the first run.  Then 2, 6.  Then 4. Then 8.  You are definitely on the right track.  Had to run it over and over to convert all.
0
 
Rgonzo1971Commented:
Without a dummy example it will be difficult to know where is the Problem

Regards
0
 
cmd407Author Commented:
I made the quick test dummy by drawing nine text boxes, dragging them in a vertical order, and typing 1asdf in the first 2asdf in the second and so on.
0
 
cmd407Author Commented:
Hey, tried it again on the original project and it got all but one box the first time.  I am happy and appreciate what you have done.  Not sure what is going on with the tester,
0
 
cmd407Author Commented:
This will save me hours of clicks.  What a great help!
0
 
cmd407Author Commented:
Sorry - meant to accept this version Posted on 2014-01-29 at 10:17:32.  Can someone fix that to avoid confusing users?
0

Featured Post

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

  • 6
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now