Move Position of Table using VBA

A

Alan

I have a word document that is created from Access which has 2 tables which
are both extendable to a number of rows dependant on nthe contents of the
query in access.

The data passes fine from Access to word, however as the first table grows
the second table over writes the last rows of the first.

Is there a way that I can use VBA (Called in Access) to move the position of
the second table to avoid overrighting of the last rows in the first table.
 
C

Cindy M.

Hi Alan,
I have a word document that is created from Access which has 2 tables which
are both extendable to a number of rows dependant on nthe contents of the
query in access.

The data passes fine from Access to word, however as the first table grows
the second table over writes the last rows of the first.

Is there a way that I can use VBA (Called in Access) to move the position of
the second table to avoid overrighting of the last rows in the first table.
By "overwrites" do you mean replaces, or superimposes?

Could you please show us the code that creates and writes to the tables, and
tell us the version of Word involved?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
A

Alan

Cindy

Sorry - Super imposes itself over the first table

The code from access simply references docVariables within the tables loops
through all entries and creates a carriage return which extends the tables
size.

In an access for I can work this out using a simple row count function that
lets me evaluate the .top of the next subform and extand the main form
accordingly

If I can use a similar mechanism to update the top of the second table then
I can move it further down the page to avoid the end of the first

I hope this makes sense
The Access code is quite lengthy but I will post if if your require further
clarification
 
C

Cindy M.

Hi =?Utf-8?B?QWxhbg==?=,
I hope this makes sense
It's not telling me what I want to know (what I suspect is
happening). You also don't give us any information about
the version of Word involved.

What I'm really interested in is the Tables.Add method (the
parameters used) and any formatting you do to the Table
(positioning kind of stuff).

The behavior you describe really should only be possible if
the table has been formatted with a "text flow" (like
around a graphic). But I find that so unlikely with tables
being created by code...

By default, the tables will *not* have this capability and
one will "push" the other down the page automatically.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 
A

Alan

Cindy

Sorry I dont mean to be obtuse and I am by no means an expert with Office or
VBA

I am using office suite 2003
I have created a word template which contains 2 tables.
Both of these are referenced from access to the template and updated using
the VBA

objWord.Documents(1).Variables("varDept") etc


Both tables grow as I loop through the entires in the Access query and enter
a carriage return to provide a paragraph/list type value to be entered as the
variable
viz:
strDept = strDept & .Fields("Department") & Chr$(11)

This presents in the table the way I want it to, but the first table does
not "push" the second table down automatically as I thought it would

I hav no formatting in my code and do not use the Tables.Add method you
describe, but clearly there is another option

I hope this clarifies where I am at and I am very much obliged for any
assistance you can provide
 
C

Cindy M.

Hi =?Utf-8?B?QWxhbg==?=,
I have created a word template which contains 2 tables...
I hav no formatting in my code and do not use the Tables.Add method you
describe, but clearly there is another option
Aha. OK. Click in the first table, go to Table/Table Properties and look in the
Table tab of the dialog box. Make sure "Text wrapping" is set to "None".

Repeat for the second table.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top