M
Marco ESMACH
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
------------------------------------------------------------------------
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
------------------------------------------------------------------------