ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with PrintArea property (https://www.excelbanter.com/excel-programming/284589-problem-printarea-property.html)

Ugleeduck

Problem with PrintArea property
 
Hello All,

Thanks in advance for reading my post. I want to give users the
ability to print a certain range via a macro. After selecting teh
range, the user should be able to click one button to print (instead
of going through File-Print Area....).

I have a very simple VB macro for this. Problem is, everytime I run
it, I get get an error saying Object doesn't support the property.
Here's the code snippet. Any help will be greatly appreciated.


Public Sub AreaPrint()
ActiveSheet.PageSetup.PrintArea = _
ActiveWindow.Selection.Address

ActiveSheet.Selection.PrintPreview
Unload Me

End Sub


If I comment out the print preview part and print directly, it works
fine.

Tom Ogilvy

Problem with PrintArea property
 
Selection.Printout

or

Selection.PrintPreview

--

Regards,
Tom Ogilvy


"Ugleeduck" wrote in message
om...
Hello All,

Thanks in advance for reading my post. I want to give users the
ability to print a certain range via a macro. After selecting teh
range, the user should be able to click one button to print (instead
of going through File-Print Area....).

I have a very simple VB macro for this. Problem is, everytime I run
it, I get get an error saying Object doesn't support the property.
Here's the code snippet. Any help will be greatly appreciated.


Public Sub AreaPrint()
ActiveSheet.PageSetup.PrintArea = _
ActiveWindow.Selection.Address

ActiveSheet.Selection.PrintPreview
Unload Me

End Sub


If I comment out the print preview part and print directly, it works
fine.





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

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