![]() |
#4
|
||||
|
||||
![]()
If you put this macro into your Excel workbook then it will create the Word document for you. Note that you need to add a Reference to the Word Object Library
Code:
Sub SendDataToWord() Dim appWord As Word.Application 'need reference to Microsoft Word x.x Object Library Dim docWord As Word.Document, rngDoc As Word.Range Dim paraWord As Word.Paragraph Dim rng As Excel.Range Dim i As Integer Set rng = ActiveSheet.UsedRange Set appWord = New Word.Application 'Create new instance of Word: appWord.Visible = True 'make the Word window visible: Set docWord = appWord.Documents.Add 'add a new word document: For i = 2 To rng.Rows.Count Set rngDoc = docWord.Content rngDoc.InsertParagraphAfter rngDoc.Collapse Direction:=wdCollapseEnd rngDoc.Text = rng.Cells(i, 1) & vbCr rngDoc.InsertAfter rng.Cells(i, 2) rngDoc.Style = "Normal" rngDoc.Paragraphs(1).Range.Style = "Heading 2" rngDoc.Collapse Direction:=wdCollapseEnd docWord.Endnotes.Add Range:=rngDoc, Text:=rng.Cells(i, 3).Text Next End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
Tags |
endnotes, footnotes |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
j hewitt | Word | 1 | 01-05-2015 10:26 AM |
![]() |
jessy_33 | Word | 1 | 05-07-2014 02:45 PM |
![]() |
mosrozen | Word VBA | 2 | 06-14-2012 06:59 AM |
![]() |
gib65 | Word | 2 | 08-15-2011 01:46 PM |
automatically extract footnotes into new file and apply character format to footnote | hrdwa | Word | 0 | 02-27-2010 03:16 AM |