#1
|
|||
|
|||
Create Table Form from Word Document
Hello,
I have a document that contains several questions that I would to transpose into a table i.e. COPY all data before a carriage return (but after the previous carriage return and PASTE it into the proposed table. I'd like to repeat that as many times as needed. Is this possible? To add further clarity if I had the following on my word document: What is your name When were you born Where were you born I would like to end up with a table which has 2 columns and 3 rows and have the questions appear in the left most column with the right most column being blank. Thank you so much to anyone who can help or at least point me in the right direction. Furthermore, I'd like this to be initiated on the word doc by a click of a button. |
#2
|
|||
|
|||
Select the paragraphs of text
Replace paragraph marks with Paragraph mark tab character With the paragraphs of text still selected, on the Insert tab, click Table then Convert text to table. OK Last edited by Kimberly; 07-29-2011 at 01:11 PM. Reason: typo |
#3
|
|||
|
|||
LOL, I didn't see this part:
Quote:
Turn on the macro recorder after you select the paragraphs of questions. |
#4
|
|||
|
|||
Select all of the text include the last paragraph mark and run this macro:
Code:
Sub ScratchMacro() 'A quick macro scratch pad created by Greg Maxey Dim i As Long, j As Long Dim arrData() As String Dim oRng As Word.Range Dim oTbl As Word.Table Set oRng = Selection.Range ReDim arrData(oRng.Paragraphs.Count - 1) For i = 0 To UBound(arrData) arrData(i) = Left(oRng.Paragraphs(i + 1).Range.Text, Len(oRng.Paragraphs(i + 1).Range.Text) - 1) Next i oRng.Delete Set oTbl = ActiveDocument.Tables.Add(oRng, UBound(arrData) + 1, 2) For i = 0 To UBound(arrData) oTbl.Cell(i + 1, 1).Range.Text = arrData(i) Next i End Sub |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How do I create an index of every word in a document? | jbengal | Word | 5 | 11-23-2022 02:17 PM |
Put a document in word into a fillable form | groovy chick | Word | 3 | 01-18-2012 04:49 AM |
How can create a form in Word 2007 that can be automatically filled? | artistech | Word | 0 | 08-04-2010 01:05 PM |
how to create a word document to be printed on a letterpad | damad | Word | 0 | 07-23-2009 12:11 AM |
How to add Table of Content in word document by C# ! ! ! | arun singh | Word | 0 | 11-12-2008 11:21 PM |