![]() |
|
|
|
#1
|
|||
|
|||
|
Hi
I have a database with 3200 lines. Each one has a title, a content and a REFERENCE field. I must export it to MS Word, so I wonder whether it is possible to somehow transform automatically the reference field into a footnote or an endnote. Of course, to start I can easily export the database to an Excel or Word table. I would really appreciate any help Greetings from Chile! |
|
#2
|
||||
|
||||
|
It might be possible with a mail merge but probably not so I think you will need a macro to export two fields to the page and one field to a footnote/endnote.
If you provide some sample data which shows the fields then perhaps someone here will write the code you need. It probably would be easiest to code if you put the sample data into either Excel or a Word table and show the look you want to achieve with the Title and Content fields.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
#3
|
|||
|
|||
|
Hi!
Here I attach the Excel file with a sample and the MS Word file of the desired output. If it was possible to provide an style for the field "Title" (for example, "Title 2", as in the exmaple) it would be even better and I would be even more grateful! |
|
#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 |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
I want to create footnotes without numbers
|
j hewitt | Word | 1 | 01-05-2015 10:26 AM |
Automatically updating cross-references in Footnotes
|
jessy_33 | Word | 1 | 05-07-2014 02:45 PM |
create footnotes from custom text
|
mosrozen | Word VBA | 2 | 06-14-2012 06:59 AM |
Can Word automatically update footnotes?
|
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 |