Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Printing displayed sheets


After working with the user to limit the number of sheets displayed in a
workbook (that includes 97 sheets) I would like to offer them the
ability to print those sheets that are visible.

Here is the code I have. It does select the sheets but I cannot print
them. I have tried the printout syntax a million different ways but
can't seem to get it to work.

Sub Print_ActiveSheets_Macro()

Sheets("Control").Select
Dim ws As Worksheet
For Each ws In Worksheets
If ws.Visible Then ws.Select False
Next ws

msg = "You are printing the sheets selected below. " & vbCrLf
msg = msg & "Do you want to continue?"

response = MsgBox(msg, vbOKCancel + vbQuestion, "Print Alert")
If response = vbOK Then ws.PrintOut
' For Each Worksheet In ws


End Sub

Thanks for your help


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Printing displayed sheets

Keep it simple:

Sub Print_ActiveSheets_Macro()
If MsgBox("You are printing all the visible sheets. " & vbCrLf _
& "Do you want to continue?", vbYesNo) = vbYes Then _
ActiveWorkbook.PrintOut
End Sub

--

Vasant



"rduke0" wrote in message
...

After working with the user to limit the number of sheets displayed in a
workbook (that includes 97 sheets) I would like to offer them the
ability to print those sheets that are visible.

Here is the code I have. It does select the sheets but I cannot print
them. I have tried the printout syntax a million different ways but
can't seem to get it to work.

Sub Print_ActiveSheets_Macro()

Sheets("Control").Select
Dim ws As Worksheet
For Each ws In Worksheets
If ws.Visible Then ws.Select False
Next ws

msg = "You are printing the sheets selected below. " & vbCrLf
msg = msg & "Do you want to continue?"

response = MsgBox(msg, vbOKCancel + vbQuestion, "Print Alert")
If response = vbOK Then ws.PrintOut
' For Each Worksheet In ws


End Sub

Thanks for your help


---
~~ 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
Cell borders are displayed but not printing or on print preview Thel Excel Discussion (Misc queries) 0 March 15th 10 08:15 AM
Printing Sheets sorryipurchased Excel Discussion (Misc queries) 0 January 20th 10 06:31 PM
PRINTING two sheets on ONE? Fecozisk Excel Discussion (Misc queries) 3 August 31st 06 04:49 AM
How to keep sheets displayed(arranged) when moving between them? Credo Excel Worksheet Functions 1 October 5th 05 06:46 PM
Sheets not getting displayed Saj Francis Excel Discussion (Misc queries) 1 October 4th 05 11:43 AM


All times are GMT +1. The time now is 06:39 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"