TextBox (Shape) Macro to put TextBox inline w/ Text & convert it'stable(s) to text

I

invisionz

I am new to Visual Basic, I am trying to learn it, but I am not that
successful with it. So, I have to ask for help because I have found
some macros, but I have butchered those up as well.

Situation:
I have saved a pdf to word document. When I opened the document there
are tons of TextBoxes and tables within those TextBoxes.

Problem:
I need to write a macro which:
1. Finds the TextBox
2. Puts it inline with text
3. Converts any Tables in the TextBox to Text, Separated by Tabs

I have quite a few of these documents and I have also purchased a
commercial product which has failed me.

Thank you for your help and consideration.
 
J

Jean-Guy Marcil

invisionz said:
I am new to Visual Basic, I am trying to learn it, but I am not that
successful with it. So, I have to ask for help because I have found
some macros, but I have butchered those up as well.

Situation:
I have saved a pdf to word document. When I opened the document there
are tons of TextBoxes and tables within those TextBoxes.

Problem:
I need to write a macro which:
1. Finds the TextBox
2. Puts it inline with text
3. Converts any Tables in the TextBox to Text, Separated by Tabs

I have quite a few of these documents and I have also purchased a
commercial product which has failed me.

I hope you got your money back!

I do not know why, but there does not seem to be a way to convert a floating
textbox to an inlineshape one with VBA. You can do it manually, but I was
surprised today to find out that it does not work with autoshapes... Why...
It is a mystery to me!

I hope someone comes along wioth a workaround...

As for converting the tables in the Textboxes to text, this can be done!


Dim shpTextBox As Shape
Dim i As Long

For Each shpTextBox In ActiveDocument.Shapes
With shpTextBox
If shpTextBox.Type = msoTextBox Then
If .TextFrame.HasText Then
With .TextFrame.TextRange
If .Tables.Count > 0 Then
For i = 1 To .Tables.Count
.Tables(1).ConvertToText wdSeparateByTabs
Next
End If
End With
End If
End If
End With
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top