Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Code printing problem

Hi there hope someone can help me deal to this.

What im trying to achieve is, Send the print job to the print previe
and finally sending the job to the printer if desired and NOT prin
blank rows beyond the actual data, keeping in mind all cells ar
populated with formula linked to sheet1. this dataset has 2 pages.
there are 15 datasets on the sheet.

this is the formula that I am using to print page one of two, I hav
another macro to print page 2 if I see it is occupied by data.

**********

this is the code that works as per last sentence.

Sub print1()
Application.ScreenUpdating = False
Sheets("Psheet").Select
Range("A1:U60").Select
ActiveWindow.SelectedSheets.PrintPreview
Selection.PrintOut Copies:=1, Collate:=True
Sheets("sheet1").Select
Range("D7").Select
Application.ScreenUpdating = True
End Sub

*************

this is the code that gives me the yes no criteria but drops the rang
selection and tries to print the entire sheet which is 30 printabl
pages. :-(

*************

Sub myprint1test()
If MsgBox("Do you want to Print this Document?", vbYesNo, "Repor
Preview and Print Check") = vbNo Then Exit Sub
Application.ScreenUpdating = False
Sheets("Print1test").Select
Range("A1:U60").Select
ActiveWindow.SelectedSheets.PrintPreview
Selection.PrintOut Copies:=1, Collate:=True
Sheets("sheet1").Select
Range("D7").Select
Application.ScreenUpdating = True
MsgBox "Your Report is now Printing"
End Sub

Hope someone can end my misery. I know it must be a simple solution t
fix it but I can't figure it out.

Im hoping to use this fix in a another spreadsheet which is about 50
rows long.

Thanks in advance

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default VBA Code printing problem

If you use printpreview it must be cleared with the c key or print key. Try
this. You do NOT have to first select the sheet or range to print. This will
work on your sheet from anywhere such as your sheet1.

Sub printpreviewit()
With Sheets("sheet11").Range("b6:b16")
..PrintPreview
'if you use preview you must touch c key to clear before continuing
ans = InputBox("Do you want to print, Enter Y for Yes or N for NO")
If UCase(ans) = "Y" Then .PrintOut
End With
End Sub

--
Don Guillett
SalesAid Software

"Fred_is_stuck " wrote in
message ...
Hi there hope someone can help me deal to this.

What im trying to achieve is, Send the print job to the print preview
and finally sending the job to the printer if desired and NOT print
blank rows beyond the actual data, keeping in mind all cells are
populated with formula linked to sheet1. this dataset has 2 pages.
there are 15 datasets on the sheet.

this is the formula that I am using to print page one of two, I have
another macro to print page 2 if I see it is occupied by data.

**********

this is the code that works as per last sentence.

Sub print1()
Application.ScreenUpdating = False
Sheets("Psheet").Select
Range("A1:U60").Select
ActiveWindow.SelectedSheets.PrintPreview
Selection.PrintOut Copies:=1, Collate:=True
Sheets("sheet1").Select
Range("D7").Select
Application.ScreenUpdating = True
End Sub

*************

this is the code that gives me the yes no criteria but drops the range
selection and tries to print the entire sheet which is 30 printable
pages. :-(

*************

Sub myprint1test()
If MsgBox("Do you want to Print this Document?", vbYesNo, "Report
Preview and Print Check") = vbNo Then Exit Sub
Application.ScreenUpdating = False
Sheets("Print1test").Select
Range("A1:U60").Select
ActiveWindow.SelectedSheets.PrintPreview
Selection.PrintOut Copies:=1, Collate:=True
Sheets("sheet1").Select
Range("D7").Select
Application.ScreenUpdating = True
MsgBox "Your Report is now Printing"
End Sub

Hope someone can end my misery. I know it must be a simple solution to
fix it but I can't figure it out.

Im hoping to use this fix in a another spreadsheet which is about 500
rows long.

Thanks in advance.


---
Message posted from
http://www.ExcelForum.com/



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
Excel 2003 printing problem--printing 1 document on 2 pages Bons Excel Discussion (Misc queries) 0 December 24th 09 04:15 PM
Printing code Jase Excel Discussion (Misc queries) 2 September 15th 08 07:49 PM
Printing code mn[_2_] Excel Programming 1 January 21st 04 12:35 AM
Use code to cancel printing Jim [email protected] Excel Programming 1 October 30th 03 10:05 PM
Improved printing of VBA code? Revolvr[_2_] Excel Programming 0 September 2nd 03 05:22 PM


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

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

About Us

"It's about Microsoft Excel"