Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
me me is offline
external usenet poster
 
Posts: 4
Default Printing Used Range--Method Print Out Failed

Good Afternoon everyone.

I need help with the following code:

Code/
Option Explicit
Sub selectAll()
Dim ws As Sheet5
Dim printMe As Range
'***** turn off
Application.ScreenUpdating = False
Set ws = Application.Sheets("InitialAssessments")
'***** THIS IS YOUR DYNAMIC RANGE HERE
ws.Activate
Set printMe = ws.UsedRange
'***** these are just options
ws.PageSetup.PrintArea = printMe.Address(False, False)
With ws.PageSetup
'***** manually set margin??????
.LeftMargin = Application.InchesToPoints(0)
.RightMargin = Application.InchesToPoints(0)
.TopMargin = Application.InchesToPoints(0.25)
.BottomMargin = Application.InchesToPoints(0.5)
.HeaderMargin = Application.InchesToPoints(0.25)
.FooterMargin = Application.InchesToPoints(0.25)
'*****
'***** other options here.
.CenterHorizontally = True
.CenterVertically = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
'***** printing here
ws.PrintOut Copies:=1, Collate:=True <----PROBLEM HERE.
'***** turn back on
Application.ScreenUpdating = True
End Sub

/Code

I get a "method Print Out of Worksheet object failed". I've tried to
figure it out, but to no avail. Please help.
Suggestions?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Printing Used Range--Method Print Out Failed

I would change
ws.PageSetup.PrintArea = printMe.Address(False, False)

to

ws.PageSetup.PrintArea = printMe.Address(False, False, xlA1,True)

make sure the code is in a general module and not in a worksheet module.

--
Regards,
Tom Ogilvy

"me" <spam@spam wrote in message
. com...
Good Afternoon everyone.

I need help with the following code:

Code/
Option Explicit
Sub selectAll()
Dim ws As Sheet5
Dim printMe As Range
'***** turn off
Application.ScreenUpdating = False
Set ws = Application.Sheets("InitialAssessments")
'***** THIS IS YOUR DYNAMIC RANGE HERE
ws.Activate
Set printMe = ws.UsedRange
'***** these are just options
ws.PageSetup.PrintArea = printMe.Address(False, False)
With ws.PageSetup
'***** manually set margin??????
.LeftMargin = Application.InchesToPoints(0)
.RightMargin = Application.InchesToPoints(0)
.TopMargin = Application.InchesToPoints(0.25)
.BottomMargin = Application.InchesToPoints(0.5)
.HeaderMargin = Application.InchesToPoints(0.25)
.FooterMargin = Application.InchesToPoints(0.25)
'*****
'***** other options here.
.CenterHorizontally = True
.CenterVertically = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
'***** printing here
ws.PrintOut Copies:=1, Collate:=True <----PROBLEM HERE.
'***** turn back on
Application.ScreenUpdating = True
End Sub

/Code

I get a "method Print Out of Worksheet object failed". I've tried to
figure it out, but to no avail. Please help.
Suggestions?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Printing Used Range--Method Print Out Failed

Thanks for the information Tom. I did as you
instructed. I changed that line of code and the Sub
procedure is in a module and not a worksheet. I am still
getting the problem on the same line as in the original
post:

code/
'***** printing here
ws.PrintOut Copies:=1, Collate:=True <---PROBLEM HERE.


Please advise if you can. What am I doing wrong?

Thank you

chris
-----Original Message-----
I would change
ws.PageSetup.PrintArea = printMe.Address(False, False)

to

ws.PageSetup.PrintArea = printMe.Address(False, False,

xlA1,True)

make sure the code is in a general module and not in a

worksheet module.

--
Regards,
Tom Ogilvy

"me" <spam@spam wrote in message
.com...
Good Afternoon everyone.

I need help with the following code:

Code/
Option Explicit
Sub selectAll()
Dim ws As Sheet5
Dim printMe As Range
'***** turn off
Application.ScreenUpdating = False
Set ws = Application.Sheets("InitialAssessments")
'***** THIS IS YOUR DYNAMIC RANGE HERE
ws.Activate
Set printMe = ws.UsedRange
'***** these are just options
ws.PageSetup.PrintArea = printMe.Address(False,

False)
With ws.PageSetup
'***** manually set margin??????
.LeftMargin = Application.InchesToPoints(0)
.RightMargin = Application.InchesToPoints(0)
.TopMargin = Application.InchesToPoints(0.25)
.BottomMargin = Application.InchesToPoints

(0.5)
.HeaderMargin = Application.InchesToPoints

(0.25)
.FooterMargin = Application.InchesToPoints

(0.25)
'*****
'***** other options here.
.CenterHorizontally = True
.CenterVertically = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
'***** printing here
ws.PrintOut Copies:=1, Collate:=True <----

PROBLEM HERE.
'***** turn back on
Application.ScreenUpdating = True
End Sub

/Code

I get a "method Print Out of Worksheet object

failed". I've tried to
figure it out, but to no avail. Please help.
Suggestions?



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Printing Used Range--Method Print Out Failed

Your options are not doing anything for you.

try

ws.PrintOut

If that doesn't work, start removing/commenting out parts of your code until
it works.

--
Regards,
Tom Ogilvy

"Chris Villanueva" wrote in message
...
Thanks for the information Tom. I did as you
instructed. I changed that line of code and the Sub
procedure is in a module and not a worksheet. I am still
getting the problem on the same line as in the original
post:

code/
'***** printing here
ws.PrintOut Copies:=1, Collate:=True <---PROBLEM HERE.


Please advise if you can. What am I doing wrong?

Thank you

chris
-----Original Message-----
I would change
ws.PageSetup.PrintArea = printMe.Address(False, False)

to

ws.PageSetup.PrintArea = printMe.Address(False, False,

xlA1,True)

make sure the code is in a general module and not in a

worksheet module.

--
Regards,
Tom Ogilvy

"me" <spam@spam wrote in message
.com...
Good Afternoon everyone.

I need help with the following code:

Code/
Option Explicit
Sub selectAll()
Dim ws As Sheet5
Dim printMe As Range
'***** turn off
Application.ScreenUpdating = False
Set ws = Application.Sheets("InitialAssessments")
'***** THIS IS YOUR DYNAMIC RANGE HERE
ws.Activate
Set printMe = ws.UsedRange
'***** these are just options
ws.PageSetup.PrintArea = printMe.Address(False,

False)
With ws.PageSetup
'***** manually set margin??????
.LeftMargin = Application.InchesToPoints(0)
.RightMargin = Application.InchesToPoints(0)
.TopMargin = Application.InchesToPoints(0.25)
.BottomMargin = Application.InchesToPoints

(0.5)
.HeaderMargin = Application.InchesToPoints

(0.25)
.FooterMargin = Application.InchesToPoints

(0.25)
'*****
'***** other options here.
.CenterHorizontally = True
.CenterVertically = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
'***** printing here
ws.PrintOut Copies:=1, Collate:=True <----

PROBLEM HERE.
'***** turn back on
Application.ScreenUpdating = True
End Sub

/Code

I get a "method Print Out of Worksheet object

failed". I've tried to
figure it out, but to no avail. Please help.
Suggestions?



.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Autofill method of range class failed Don Guillett Excel Discussion (Misc queries) 0 February 27th 08 03:56 PM
Autofill method of range class failed Appache Excel Discussion (Misc queries) 5 February 27th 08 03:37 PM
Method 'Range' of object '_global' failed higherlimits Excel Discussion (Misc queries) 3 June 23rd 06 06:16 PM
Method 'Range" of object'_Global' failed Tim Excel Programming 2 February 23rd 04 08:37 PM
Method 'Range' of object '_Global' failed Mohanasundaram[_2_] Excel Programming 1 August 25th 03 01:43 PM


All times are GMT +1. The time now is 10:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"