Print Code


Posted by Jeremy on June 22, 2000 4:04 AM

Ivan once helped me out on this, but I've lost the code.

I need a Macro that will print out all sheets in a workbook except a specified sheet.

Say specified sheet is called Zulu.

eg I have sheets called Alpha, Beta, Charlie & Zulu. I need only Alpha, Beta, Charlie printed.

I need the macro to be flexible so if I get rid of say Charlie and add Delta. Alpha, Beta & Delta will be the only ones printed.

Thanks,

Jeremy.

Posted by Keith on June 27, 0100 1:21 AM

Re: Modified Code - Skol

Ryan, you be the messiah! (no offence to all those religious folks)

It works like a dream.

Merci beaucoup.

Keith

Posted by Keith on June 26, 0100 7:22 AM

2 quick Questions

Thanks Ryan,

Just 2 little questions;

1) Is there a way with that code you suggested to omit a sheet in the check box list?
(if there is the sheet is called "1 print").

2) Is there a way to highlight (insert ticks) in all boxes?

But once again, many thanks. The solution you gave me was even better than what I had planned.

Keith.

Posted by Ryan on June 26, 0100 7:41 AM

Modified Code

Keith,
Here is an a modified For Next Loop that will take care of what you want. If you take a look at it, it checks the name of the worksheet before it adds it to the dialogbox and if it's name is "1 Print" it will skip it. Second, when it adds each check box, it makes all of their values true, which will put the check in them. Just copy this code. Go into the old code and highlight the same section, and paste this over it. Hope this solves your problems, let me know
Ryan

For i = 1 To ActiveWorkbook.Worksheets.Count
Set CurrentSheet = ActiveWorkbook.Worksheets(i)
' Skip empty sheets and hidden sheets
If Application.CountA(CurrentSheet.Cells) <> 0 And _
CurrentSheet.Visible Then
If CurrentSheet.Name <> "1 Print" Then
SheetCount = SheetCount + 1
PrintDlg.CheckBoxes.Add 78, TopPos, 150, 16.5
PrintDlg.CheckBoxes(SheetCount).Text = _
CurrentSheet.Name
PrintDlg.CheckBoxes(SheetCount).Value = True
TopPos = TopPos + 13
End If
End If
Next i



Posted by Ryan on June 23, 0100 12:43 PM

Check out this page. It has a pretty cool solution to your problem. Hope it works, let me know.
Ryan
http://www.j-walk.com/ss/excel/tips/tip48.htm