M
Marian
I am using
Selection.CopyPicture Appearance:=xlPrinter, Format:=xlPicture
I was thinking that this code would copy a worksheet as it looks when
printed from Excel. My worksheet when printed is nicely formatted and is
printed in landscape and is 3 pages long. When I use the code below, all it
does is past the range and crams the whole thing on one page in Word without
any landscape, page formatting, etc.
Any suggestions on how to really copy and past someting "as it looks when
you print it out on the printer"?
Thanks.
Marian
Sub pictureasprinted()
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Range("A5:N113").Select
Selection.CopyPicture Appearance:=xlPrinter, Format:=xlPicture
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Add ' create a new document
With wrdDoc
.Content.Paste
.SaveAs ("C:\Foldername\MyNewWordDoc5.doc")
.Close ' close the document
End With
wrdApp.Quit ' close the Word application
Set wrdDoc = Nothing
Set wrdApp = Nothing
End Sub
Selection.CopyPicture Appearance:=xlPrinter, Format:=xlPicture
I was thinking that this code would copy a worksheet as it looks when
printed from Excel. My worksheet when printed is nicely formatted and is
printed in landscape and is 3 pages long. When I use the code below, all it
does is past the range and crams the whole thing on one page in Word without
any landscape, page formatting, etc.
Any suggestions on how to really copy and past someting "as it looks when
you print it out on the printer"?
Thanks.
Marian
Sub pictureasprinted()
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Range("A5:N113").Select
Selection.CopyPicture Appearance:=xlPrinter, Format:=xlPicture
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Add ' create a new document
With wrdDoc
.Content.Paste
.SaveAs ("C:\Foldername\MyNewWordDoc5.doc")
.Close ' close the document
End With
wrdApp.Quit ' close the Word application
Set wrdDoc = Nothing
Set wrdApp = Nothing
End Sub