PDA

View Full Version : Add New line above inlineshapes.



Tajudeen
09-14-2013, 02:54 AM
Copying Excel Data Range and pasting it in word Document as an image. Now i want to add new line above the all images . before or after pasting an image. A) This code is for Copy from Excel : MyXLSheet.Range(MyXLSheet.Cells(i, 1), MyXLSheet.Cells(lastRow, lastCol)).Copy and B) This code is for Pasting in Word : wrddoc.Paragraphs(wrddoc.Paragraphs.Count).Range.PasteSpecial Link:=False, DataType:=wdPasteBitmap, Placement:=wdFloatOverText . Now i want to add new line above the image so that user can type some text. I tried many ways but could not solve it. Help ME pls

patel
09-14-2013, 04:31 AM
paste here please your whole code or, better, attach a sample file

Tajudeen
09-14-2013, 04:51 AM
Set appWD = CreateObject("Word.Application")Set wrddoc = appWD.Documents.AddappWD.Activate For Each pb In MyXLSheet.HPageBreaks pageRow = pb.Location.Row MyXLSheet.Activate MyXLSheet.Range(MyXLSheet.Cells(i, 1), MyXLSheet.Cells(pageRow - 1, lastCol)).Copy wrddoc.Paragraphs(wrddoc.Paragraphs.Count).Range.InsertParagraphAfter wrddoc.Paragraphs(wrddoc.Paragraphs.Count).Range.PasteSpecial Link:=False, DataType:=wdPasteBitmap, Placement:=wdFloatOverText wrddoc.Paragraphs(wrddoc.Paragraphs.Count).FirstLineIndent = InchesToPoints(-0.5) wrddoc.InlineShapes(wrddoc.InlineShapes.Count).LockAspectRatio = False wrddoc.InlineShapes(wrddoc.InlineShapes.Count).Height = InchesToPoints(6.9) wrddoc.InlineShapes(wrddoc.InlineShapes.Count).Width = InchesToPoints(6.5) Next MyXLBook.Close False

patel
09-14-2013, 08:34 AM
I need code for testing, you did not paste the whole code, attach please a sample file