Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sequence of Writing to Word document
#1
Hello,
I take screenshots and write them to word documents. When I add the second screenshot it is added in the first page and the image in the first page is moved to the second page. Is there a way to add an image at in the second page ? In other words I want to add new pages in Word at the bottom of the current page (not on the top)

Code:
Dim Wrd Dim WrdDoc Const Wrdalignpgraphleft=1 Set Wrd=CreateObject("Word.Application") Const wdOrientLandscape = 1 Wrd.Visible=False Set WrdDoc=Wrd.Documents.Open (WordDocumentName , False) Set Selection = Wrd.Selection Selection.TypeText Comment & " -- Test Executed : "&NOW Selection.TypeParagraph WrdDoc.Range.Select WrdDoc.Range.Select With Wrd.ActiveDocument.PageSetup .Orientation = wdOrientLandscape .TopMargin = Wrd.InchesToPoints(0.92) .BottomMargin = Wrd.InchesToPoints(0.92) .LeftMargin = Wrd.InchesToPoints(0.30) .RightMargin = Wrd.InchesToPoints(0.5) .PageWidth = Wrd.InchesToPoints(12) .PageHeight = Wrd.InchesToPoints(10) End With Set img= WrdDoc.InlineShapes.AddPicture(ConfirmationBMP, True) img.Width=img.Width*1 img.Height=img.Height*1 img.range.paragraphformat.Alignment=Wrdalignpgraphcenter WrdDoc.Save WrdDoc.close Wrd.Quit Set Wrd=nothing Set WrdDoc=nothing Set WrdDocsel=nothing Set img=nothing

Thanks,
Raj
Reply
#2
after each time when you write in the doc you can insert a pagebreak there
Code:
Const wdPageBreak = 7 Selection.InsertBreak(wdPageBreak)

does this help?

Reply
#3
Saket,
Thanks for the suggestion. The state creates a page break, but dose not accomplish the desired result.

Thanks,
Raj
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Check the word and get no. of times that word in the webpage Sandeep.san229 0 1,925 10-31-2018, 06:42 PM
Last Post: Sandeep.san229
  pageDown in word.application wannel 0 2,111 11-25-2016, 10:06 PM
Last Post: wannel
  Automating Word Docs bart02 0 3,169 07-18-2014, 03:25 AM
Last Post: bart02
  Does QTP support writing runtime data to multiple sheets in excel Shwethareddy 2 4,190 10-16-2012, 12:20 PM
Last Post: Shwethareddy
  Inserting Images in the Word file. atulparate 2 7,570 04-09-2012, 12:44 PM
Last Post: swathi

Forum Jump:


Users browsing this thread: