Getting the size of empty space at the end of a document, please

M

Mike

Hi! I need to determine the amount of empty space at the end of a document,
so I could insert a small document into that space.

I need 2 methods:

1) Figure out how to determine a size of any document

2) How to determine the amount of empty space at the end of a document.

Once I get the space available using method # 2 I will search for the best
fit determined by method # 1.

Is it possible at all? I can not find anything in the API docs.


The final Word document will be used by our
printing department. They do not feel that any professional layout package
such as Indesign by Adobe or Quark can give them bang for their bucks.
They just want to use Word to arrange simple layout of future newsletters
consisting of hundreds if not thousands of individual Word documents. That's
where automation comes to play. They will use a legal size paper and just
append one document to another. However, they do not want too many page
breaks and they want to minimize the amount of white space in between
documents.



Many Thanks in Advance,

--Michael
 
J

Jean-Guy Marcil

Mike was telling us:
Mike nous racontait que :
Hi! I need to determine the amount of empty space at the end of a
document, so I could insert a small document into that space.

I need 2 methods:

1) Figure out how to determine a size of any document

2) How to determine the amount of empty space at the end of a
document.

Once I get the space available using method # 2 I will search for the
best fit determined by method # 1.

Is it possible at all? I can not find anything in the API docs.


The final Word document will be used by our
printing department. They do not feel that any professional layout
package such as Indesign by Adobe or Quark can give them bang for
their bucks.
They just want to use Word to arrange simple layout of future
newsletters consisting of hundreds if not thousands of individual
Word documents. That's where automation comes to play. They will use
a legal size paper and just append one document to another. However,
they do not want too many page breaks and they want to minimize the
amount of white space in between documents.

This can be fairly complicated as Word is not designed to work like that.

However, you can use simple maths to figure out the area used by the printed
stuff.

Used area =
Width = Page width - (left margin + right margin)
times
Length = absolute position of last character on page - top margin

Use stuff like
MsgBox = Selection.Information(wdVerticalPositionRelativeToPage)
MsgBox = Selection.Sections(1).PageSetup.BottomMargin
to get the various bits.

Do the calculation for the target page and for the document to insert,
compare the numbers...

But this will be difficult to handle.

Or, you can forgo the numbers.
Just insert the document at the end of the target document, if the number of
pages has increased, it does not fit, so undo the insertion.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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