Bitmap in Header of Document with MultiPage Table?

J

James Pannozzi

Inserting a Bitmap into a Word Header via VBA works perfectly

' 'Insert Logo Into Header (good for all pages)
objWord.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
objWord.Selection.InlineShapes.AddPicture "C:\CGLogo.bmp", False, True


UNLESS the document happens to have a multi-page table in which case
mysterious almost all blank pages appear (with a few table rows on them and
the rest of the
page blank) in the middle of the table on several pages.


The table is a tab seperated text file, read into the document via
InsertFile
and then converted to text via ConvertToTable.


The table is 40 lines to a page, done by the following VBScript:

Dim i

If objWord.ActiveDocument.Tables(1).Rows.Count > 40 Then

For i = 41 To objWord.ActiveDocument.Tables(1).Rows.Count Step 40


objWord.ActiveDocument.Tables(1).Cell(i,1).Range.Paragraphs(1).Format.PageBr
eakBefore = True

Next

End If

Using VBA, I am inquiring:

How insert the bitmap logo without messing up the 40 table rows per page ?

How insert Header text from a file, directly underneath the bitmap logo in
the header
(again, without disturbing the table rows)?

Thanks
Jim
 
J

James Pannozzi

Found it.

Apparently, if you tell it you want 40 table rows per page but then don't
leave enough room for that many table rows
(for example if you made the header text +logo and the trailer text too
big), it appears that Word tries
to do the most logical thing which is to spill over the excess rows that
did'nt fit onto a seperate page and then
on the page after the spillover page it resumes trying to fit 40 rows.

The solution is to lessen the number of rows per page and lessen the size of
the header and trailer in the page setup and/or to lessen the amount of text
in the trailer.

There is still a gap of whitespace so there must be some other formatting
thing I should do because there appears
to be plenty of room for another 4-5 rows. Probably a margin adjustment.

Last but not least, I need to figure out how to align text that I am
inserting from a file into the header.
Some of this header text would be left justified and some of it centered and
some right justified, as in
Name:John Jones DOB:09/12/1768 Status:Alien
Location:Somewhere

I can see that this might be the stuff for another posting in the making.

J
 
J

James Pannozzi

Last but not least, I need to figure out how to align text that I am
inserting from a file into the header.
Some of this header text would be left justified and some of it centered and
some right justified, as in
Name:John Jones DOB:09/12/1768 Status:Alien
Location:Somewhere

I can see that this might be the stuff for another posting in the making.

J


Took care of this too.

Perhaps it is best to approach these header formatting problems
"TABula Rasa".

J
 

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