Sending Output to a Word or Excel Doc/Spreadsheet

  • Thread starter Thread starter Derek
  • Start date Start date
D

Derek

I have a simple app that logs details of my customers and the work done for
them. It uses a few tables in Access and allows me to keep a basic record of
things for my accountant.

How can I output the billing info from my app to the Word doc or maybe Excel
spreadsheet? I can gather all the info I need from a query but I have
trouble sticking into a word document so the info is placed in the correct
places in it. ie: name, address, billing info, amounts, etc.

I can create an instance of work in VB.Net but beyond that I'm lost. Could
somebody point me in the right direction for what must be a much used piece
of coding, or just provide any old advice??

Derek
 
Hey.

The easiest way to do this (assuming that you are using
standard word documents, etc.) is to edit the standard
documents so that the places where you would like to add
this data into are Text Fields. Then, for the properties
of the textfields, change the name to something you'll
remember (ie. txtName, txtAddr1, etc.). Then, add these
standard documents to the project as embedded resources.

In runtime, you'll want to extract these standard docs to
temp folders, and then load the docs into Word. Then,
you'll just cycle through all of the Document.FormFields
and find the one with the correct name (ie. txtName,
etc.) and set that FormField.Result to the string
representation of whatever that Field's data should be.

To do this, I'm assuming that you have an understanding
of the Word object model, and know how to extract
embedded resources. If you have any further questions,
or aren't too sure how to go about doing what I said
above, don't hesitate to shoot me an email and ask.

Good luck!
Ben
 
Back
Top