#1
|
|||
|
|||
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" |
#2
|
||||
|
||||
Try:
Code:
Dim Rng As Range With ActiveDocument Set Rng = .Range With Rng .Collapse direction:=wdCollapseEnd .InsertBreak Type:=wdPageBreak .Collapse direction:=wdCollapseEnd End With .Shapes.AddPicture LinkToFile:=False, Anchor:=Rng, _ FileName:="C:\somefilename.bmp", _ SaveWithDocument:=True, Left:=300, Top:=1, Width:=100, Height:=100 End With
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Solved
Thanks again. As I expected the problem persists with textboxes but that is another thread....
|
Tags |
addpicture, coordinates, pagebreak |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calculate the coordinates of a DocVariable, Bookmark or paragraph. | MaxInCO | Word VBA | 5 | 12-11-2013 03:28 PM |
Page layout: skipping one page for new elements added at end of a page | MarcA | Word | 3 | 09-30-2013 02:58 PM |
2 page document printing problem, text from page 1 in layout of page 2 when printed | laurawether45 | Word | 1 | 08-02-2012 07:03 AM |
x,y,z coordinates with single space "need tab" | gsrikanth | Excel | 1 | 07-07-2012 08:16 AM |
MS Word, page goes to next page when entering data on previous page | munna94 | Word | 2 | 12-30-2010 08:12 AM |