ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Print Code (https://www.excelbanter.com/excel-discussion-misc-queries/152853-print-code.html)

Sunday88310

Print Code
 
Using 2007
The code gets hung up at
Range("Print_Area").select
------------------------------------

Public Sub PrintYTD()

'
' Procedure to print Year To Date Sales report.
'
'

Range("Print_Area").Select
With ActiveSheet.PageSetup
.Orientation = xlLandsacpe
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Selection.PrintOut Copies:=1
Range("F1").Select

End Sub
--
William<"M"



Sunday88310

Print Code
 
The error message reads
Select Method of Range Class Failed
RunTime Error 1004
--
William<"M"




"Sunday88310" wrote:

Using 2007
The code gets hung up at
Range("Print_Area").select
------------------------------------

Public Sub PrintYTD()

'
' Procedure to print Year To Date Sales report.
'
'

Range("Print_Area").Select
With ActiveSheet.PageSetup
.Orientation = xlLandsacpe
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Selection.PrintOut Copies:=1
Range("F1").Select

End Sub
--
William<"M"



Sunday88310

Print Code
 
I found this web site address and found out what is causing
This problem. "Copying the sheet programmatically"

http://support.microsoft.com/default.aspx/kb/210684

Thank you, anyone that may have been working on it..
--
William<"M"




"Sunday88310" wrote:

The error message reads
Select Method of Range Class Failed
RunTime Error 1004
--
William<"M"




"Sunday88310" wrote:

Using 2007
The code gets hung up at
Range("Print_Area").select
------------------------------------

Public Sub PrintYTD()

'
' Procedure to print Year To Date Sales report.
'
'

Range("Print_Area").Select
With ActiveSheet.PageSetup
.Orientation = xlLandsacpe
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Selection.PrintOut Copies:=1
Range("F1").Select

End Sub
--
William<"M"




All times are GMT +1. The time now is 03:01 PM.

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