table to text macro - formakler.doc (0/1)

A

aamehl

Hi,

I am quite new to vba and am trying to take text in a table and create
from it phrases.
I enclosed a word doc with one such table.

The first non header row contains:
Modulator 1 ASI-R Modulator 1 ASI-R/IPE 1 Out 1 IPE 1 OUT 1
IPE 1 Out 1/Modulator 1 ASI-R

I need it to create a two phrases as follows:

Connect one end of the Modulator 1 ASI-R/IPE 1 Out 1 cable to the
Modulator 1 ASI-R port, and the other end to the IPE 1 OUT 1 port.

and

Connect one end of the IPE 1 Out 1/Modulator 1 ASI-R cable to the IPE
1 OUT 1 port, and the other end to the Modulator 1 ASI-R port.
---------------------------------------------------------------------------------
Here is what I have done so far:

Sub BuildProcsFromTab()

Dim TableI As Table
Dim Text1 As String
Dim Doc As Document
Dim rngRange As Range
Dim Para As Paragraph
Dim RowI As Row
Dim firstPhrase As String
Dim secondPhrase As String
Dim thirdPhrase As String
' *** Set up your column IDs here
Const Col_1 = 1
Const Col_2 = 2
Const Col_3 = 3
Const Col_4 = 4
' *** End

Set TableI = Selection.Tables(1)
Set rngRange = _
ActiveDocument.Paragraphs.Last.Range

For Each RowI In TableI.Rows

Text1 = RowI.Cells(Col_2).Range.Text
Text2 = RowI.Cells(Col_1).Range.Text
Text3 = RowI.Cells(Col_4).Range.Text
firstPhrase = "Connect one end of the "
secondPhrase = " cable to the "
thirdPhrase = " port, and the other end to the "
rngRange.InsertAfter _
firstPhrase & Text1 & secondPhrase & Text2 & thirdPhrase &
Text3



Next RowI
End Sub


The problems I am having are:

1. I need to skip the header row.
2. I don't want paragraph marks inbetween each section.
3. I want to add formatting (a style) to phraseOne (from my template)
4. I want to add a period at the end of each sentence
5. Once the above is working I need to have phrase two constructed.
6. another macro to put the finished phrases in the correct sections
in the documents. (but thats for later)

Could someone tell me how to get this working?

Thanks
Aaron
 

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