Solved

MS Word 2010 - Convert Text Boxes + Autoshapes to Text

Posted on 2014-01-29
10
916 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 50

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 50

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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

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
 
LVL 50

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
This article describes how to use the Send to Mail Recipient command. The instructions apply generally to Office 2007 and later versions, but Microsoft® Word 2013 was used for the specific steps and figures.  What is Send to Mail Recipient? Send…
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
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…

735 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