ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Marco for pasting in word (https://www.excelbanter.com/excel-programming/399564-marco-pasting-word.html)

Marco ESMACH

Marco for pasting in word
 
Hi,
I want to use a macro to copy many selected range from excel to word.
The ranges have different sizes and I paste as bitmap for a easy
correc pasting.
Questions:
how to set the page orientation "landscape"?
how to insert page break in .doc document?
how to insert many ranges? (with the attached code, only rnValue2 is
visible)


I start with this code:
------------------------------------------------------------------------
Sub copia()
Dim wApp As Object
Dim wDoc As Object
Dim rnValue As Range

Set rnValue1 = Range("utile!A2:K59")
Set rnValue2 = Range("utile!A60:K94")
Set wApp = CreateObject("Word.Application")

With wApp.Documents.Add()
rnValue1.Copy
..Content.PasteSpecial Link:=False, DataType:=wdPasteBitmap,
Placement:= _
wdFloatOverText, DisplayAsIcon:=False
rnValue2.Copy
..Content.PasteSpecial Link:=False, DataType:=wdPasteBitmap,
Placement:= _
wdFloatOverText, DisplayAsIcon:=False
Application.CutCopyMode = False
..SaveAs Filename:=ThisWorkbook.Path & "\riassunto.doc"
..Close
End With
wApp.Quit
End Sub
------------------------------------------------------------------------



All times are GMT +1. The time now is 02:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com