View Single Post
 
Old 12-03-2014, 05:31 PM
Deltaj Deltaj is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Nov 2014
Posts: 5
Deltaj is on a distinguished road
Default addpicture coordinates keep me in the first page

I am working on a A6 card landscape layout and all the code is working fine to create the first page. After the final paragraph, I used this code (I copied it from a help page) to force a page break and start the next page:

With ActiveDocument.Paragraphs(6).Range
.Collapse direction:=wdCollapseEnd
.InsertBreak Type:=wdPageBreak
End With

The code then repeats to enter the same text again (ultimately each page text will differ, but for debugging I'm using the same code with incremented paragraph numbers. The text goes in as expected on the second page but a logo inserted with this code does not:

ActiveDocument.Shapes.AddPicture FileName:= _
"C:\somefilename.bmp", LinkToFile:=False, _
SaveWithDocument:=True, Left:=300, Top:=1, Width:=100, Height:=100

The logo over-prints the existing logo on the first page, not on the second page as required. How do I tell vba to measure the coordinates from the top of the second (and subsequent) pages?

I also have code to put in textboxes with similar type coordinates and I suspect these will have the same problem. Eventually I plan to put the code in a loop, read from a txt file for data, and repeat many times to print out a lot of A6 size cards.
Thank you for any help.

Last edited by Deltaj; 12-03-2014 at 05:41 PM. Reason: incorrect title should be "addpicture"
Reply With Quote