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 / Word / Programming / January 2005

Tip: Looking for answers? Try searching our database.

Populate Word Table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ted - 20 Jan 2005 17:35 GMT
Would someone please tell me how to populate a Word 5 Column Table with data
retrieved from a Sql Server via ADODB connection.  I would like the data to
look like a Report in Word.  I know how to make the connection however I
don't know how to format it nicely in Word.
thanks,
Ted
Malcolm Smith - 20 Jan 2005 19:33 GMT
Ted

It depends on how big the table is going to be. For some of my reports
which I make I don't use tables but, rather, I use Tabs because using
tables is slower and make for fatter Word documents.

If you know how to make the Connection object then I guess that you know
how to make the RecordSet object.

So, I am not sure what you want to do next.   But if you this regularly
then may I suggest that you set up a template and then create your data
report in there and then you know how it's going to look.

To populate the table you can put the selection into the first column and
the second row of the table (say it's table one) as I am assuming that row
one is for the title and then something like:

 oDoc.Tables(1).Cell(2,1).range.select
 Do while not oRS.EOF
   selection.typetext ors("Col_01")
   selection.typetext vbtab  ' or whatever it is to go to the next cell
   
   ' and so on
   oRS.MoveNext
 loop
 
Something like that.    But if you have the table setup in a template
first then you know how it's going to look and you don't need to change
the code each time you want to change the layout.

Hope this is a help.
 - Malc

> *From:* Ted<Ted@discussions.microsoft.com>
> *Date:* Thu, 20 Jan 2005 09:35:02 -0800
[quoted text clipped - 5 lines]
> thanks,
> Ted
Alex Ivanov - 20 Jan 2005 19:47 GMT
Ted,
Create an autotext entry containing a single row of your table with
bookmarks in each field and insert that autotext for every record in the
recordset. Please look at this sample. It uses Access as a source, but will
work with any ADODB recordsets if you made proper adjustments.
http://www.aleksoft.net/samples/TestReport.zip

Signature

Please reply to NG only. This email is not monitored.
Alex.

> Would someone please tell me how to populate a Word 5 Column Table with
> data
[quoted text clipped - 4 lines]
> thanks,
> Ted
 
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.