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 / September 2006

Tip: Looking for answers? Try searching our database.

Creating a table at the end of a document and populating with data

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SJ - 06 Sep 2006 05:56 GMT
Hello everyone,

Could some kind soul please offer me some starting code for the above?

I'd be in Access.
I'd be using a document variable such as WordDoc

I do a mail merge then have a document sitting there and now they want a
Schedule in table form at the end.

So what i'm looking to do is to add a table with probably a set number of
columns, say 4 or 5,  and then start to fill out the table with data from
the database.

So i'd need to see how to create the table at the end of the document and
then how to access the fields so that I could insert the appropriate data.

oh yes,  would only know the number of rows required after running query.

Thank you for reading...
Jezebel - 06 Sep 2006 06:33 GMT
Something along these lines --

Dim pTable as Word.Table
Dim pIndex as long

With WordDoc
   pIndex = .Range.end - 1
   set pTable = .Tables.Add Range:=.Range(pIndex ,pIndex ), NumRows :=
RS.RecordCount, NumColumns:=4
End With

for pIndex = 1 to RS.RecordCount
   pTable.Cells(pIndex,1) = pRS(1)
   pTable.Cells(pIndex,2) = pRS(2)
   :
Next

> Hello everyone,
>
[quoted text clipped - 16 lines]
>
> Thank you for reading...
Peter Jamieson - 06 Sep 2006 11:28 GMT
You can always consider doing it using a DATABASE field in the document.
However, you have little control over the layout and Word is also capable of
getting rather confused between the DATABSE's data source and the mail
merge's data source.

Peter Jamieson

> Hello everyone,
>
[quoted text clipped - 16 lines]
>
> Thank you for reading...
 
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.