Solved

MS Word 2010 - Convert Text Boxes + Autoshapes to Text

Posted on 2014-01-29
10
851 Views
Last Modified: 2014-02-03
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
Comment
Question by:cmd407
  • 6
  • 3
10 Comments
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 39817864
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
 

Author Comment

by:cmd407
ID: 39818220
It sticks on line 8:
 oShape.ConvertToInlineShape
0
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39818550
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
 

Author Comment

by:cmd407
ID: 39818761
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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 39818808
Without a dummy example it will be difficult to know where is the Problem

Regards
0
 

Author Comment

by:cmd407
ID: 39818882
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
 

Author Comment

by:cmd407
ID: 39818900
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
 

Author Comment

by:cmd407
ID: 39819001
This will save me hours of clicks.  What a great help!
0
 

Author Comment

by:cmd407
ID: 39819015
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sharepoint 2013 Library List View Limitations 9 50
Header of docx file 17 97
Word Template Mail merge with vb.net 4 58
Convert .PDF 6 59
Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now