Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / January 2008

Tip: Looking for answers? Try searching our database.

export information from excel to word doc template

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Aaron Hodson (Coversure) - 25 Jan 2008 11:33 GMT
I have an excel doc/table A3-M3 downwards.

in N3 etc, I would like a button that, when pressed, will open a word.doc
template and export data in A3 into a particulr section in that document.
It will also take info from B3 to another part, B4 to another etc etc.

Is this possible?

Thank you in anticipation.

Kind regards

Aaron
Arvi Laanemets - 25 Jan 2008 11:53 GMT
Word Mail Merge with Excel table as source (it works opposite you asked - in
word you open a MM template, determine filter conditions, and document(s)
based on data in source table is/are generated/printed/mailed (you can
select different outputs there).

But you must have all info for document in single row of excel table. And
the table MUST have a single header row. And am best keep things with table
as as possible - keep the source table as first in workbook, and start the
table a top of sheet (headers start from A1).

Signature

Arvi Laanemets
( My real mail address: arvi.laanemets<at>tarkon.ee )

>I have an excel doc/table A3-M3 downwards.
>
[quoted text clipped - 9 lines]
>
> Aaron
Aaron Hodson (Coversure) - 25 Jan 2008 12:16 GMT
Thanks Arvi,

I was hoping it would be possible to export rather than import,

At present I am inputting information into excel as a of log of information,
once completed, I then open my MSWord template and have to retype all
information.

My excel spreadsheet is normally about 90 rows long per month and I thought
that it may have been possible to click a button to export the info from
that particular row into a word document.

Though I appreciate the prompt reply, it wouldn't be helpful to mail merge
from word.

Thanks

Aaron

> Word Mail Merge with Excel table as source (it works opposite you asked -
> in word you open a MM template, determine filter conditions, and
[quoted text clipped - 19 lines]
>>
>> Aaron
Arvi Laanemets - 25 Jan 2008 12:33 GMT
And why isn't MM helpful then?

You type information into excel, and close the file;
You open Word, and open our MM template (it isn't your document template,
probably you have to create it jet, to link your excel table with it, and
save it);
You start MM with template open, and determine which rows from your table
are processed;
You determine output media;
You process MM - document or documents are created or printed or set as
e-mails.

Next time you enter new info into excel table, save it or close the file,
open MM template you created earlier, determine which rows to process this
time, and create new outputs, etc.

Signature

Arvi Laanemets
( My real mail address: arvi.laanemets<at>tarkon.ee )

> Thanks Arvi,
>
[quoted text clipped - 39 lines]
>>>
>>> Aaron
ryguy7272 - 25 Jan 2008 14:44 GMT
It is not only possible, it is quite easy too.  Check out these resources:

http://word.mvps.org/faqs/interdev/ControlXLFromWord.htm

http://word.mvps.org/FAQs/InterDev/ControlWordFromXL.htm

This is what I use personally:
http://word.mvps.org/FAQs/InterDev/FillListBoxFromXLDAO.htm

If you use this technique, you will have to create a UserForm (called
'UserForm1') and a ListBox (called 'ListBox1') and a CommandButton (called
'CommandButton1').    

When you double-click on the CommandButton, you need to have code such as:
Private Sub CommandButton1_Click()
   ListBox1.BoundColumn = 1
   ActiveDocument.Variables("Tracking_Number").Value = ListBox1.Value
   ListBox1.BoundColumn = 2
   ActiveDocument.Variables("First_Name").Value = ListBox1.Value
   ListBox1.BoundColumn = 3
   ActiveDocument.Variables("Last_Name").Value = ListBox1.Value
   ActiveDocument.Fields.Update
   UserForm1.Hide
End Sub

Also, you need to have code such as:
Private Sub UserForm_Initialize()

   Dim db As DAO.Database
   Dim rs As DAO.Recordset
   Dim NoOfRecords As Long

   ' Open the database
   Set db = OpenDatabase("C:\Test\Book1.xls", False, False, "Excel 8.0")

   ' Retrieve the recordset
   Set rs = db.OpenRecordset("SELECT * FROM `myDatabase`")

   ' Determine the number of retrieved records
   With rs
        .MoveLast
        NoOfRecords = .RecordCount
        .MoveFirst
   End With

   ' Set the number of Columns = number of Fields in recordset
   ListBox1.ColumnCount = rs.Fields.Count

   ' Load the ListBox with the retrieved records
   ListBox1.Column = rs.GetRows(NoOfRecords)

   ' Cleanup
   rs.Close
   db.Close

   Set rs = Nothing
   Set db = Nothing

End Sub

Finally, in your Word document, or Word Template, you need to go to:  Insert
> Field > DocumentVariable...then name the variable...such as
Tracking_Number, or First_Name, or Last_Name...

Hope that helps!

Regards,
Ryan--

Signature

RyGuy

> And why isn't MM helpful then?
>
[quoted text clipped - 55 lines]
> >>>
> >>> Aaron
Aaron Hodson (Coversure) - 25 Jan 2008 16:40 GMT
Thank you very much,

Will work on this over the next few days.

Thanks again for the replies,

Aaron

> It is not only possible, it is quite easy too.  Check out these resources:
>
[quoted text clipped - 132 lines]
>> >>>
>> >>> Aaron
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.