LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problems with simple print macros

Hi all,

I've tried to create (i.e. cut and paste several macros from
public.excel.programming) several print macros for my workbooks. One
has been designed to print two sheets only, "total" and "monthly" and
the other has been designed to print all other sheets other than the
aforementioned two and hidden worksheets. An option I'd like to add to
both is to allow the user to select whether he/she wants to print in
color or in grayscale, but I seem to be unable to do this. For
example, macro1 is:

Private Sub commandbutton1_click()
Sheets(Array("Total", "Monthly")).Select
PageSetup.BlackAndWhite = _
MsgBox("Do you want to print in color?", _
vbYesNo, "Print Options") = vbNo
Application.Dialogs(xlDialogPrint).Show
Sheets("Total").PageSetup.BlackAndWhite = False
Sheets("Monthly").PageSetup.BlackAndWhite = False
End Sub

This currently prints the "Total" sheet as the user specified, but
always prints "Monthly" in color. I assume I'm not selecting both
sheets correctly but I can't seem to get it to work.

I'd also like to add this option to the second macro, but I can seem to
be able to place it within the macro correctly so it prints out all
selected sheets as specified.

Private Sub CommandButton2_Click()
Dim Sheet As Worksheet
Dim lAnswer As Long
Dim lSheet As Long
Dim sh As Worksheet
Dim arySheets
lAnswer = MsgBox("This report contains " & Sheets.Count - 10 & _
" sheets - Do you want to print them all?", vbYesNo, "Print?")
If lAnswer = vbNo Then
Exit Sub
Else
ReDim arySheets(1 To 1)
For Each sh In ActiveWorkbook.Worksheets
If sh.Name < "Total" And sh.Name < "Monthly" And sh.Visible =
xlSheetVisible Then
lSheet = lSheet + 1
ReDim Preserve arySheets(1 To lSheet)
arySheets(lSheet) = sh.Name
End If
Next sh
Worksheets(arySheets).Select
Application.Dialogs(xlDialogPrint).Show
Sheets("Total").Select
End If
End Sub

Thanks to anyone who can offer any help.
B.Hurness

 
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
simple i am hoping with macros chip_pyp Excel Discussion (Misc queries) 1 March 26th 06 04:14 PM
Simple Interest Calculation Problems Lisa Excel Discussion (Misc queries) 1 March 2nd 06 03:27 PM
Problems calling macros in addin from within macros Andibevan[_4_] Excel Programming 2 August 16th 05 09:29 AM
simple question about macros mati Excel Programming 3 April 22nd 05 01:43 PM
My problems with simple addition ... Larry Levinson Excel Programming 4 April 23rd 04 05:20 PM


All times are GMT +1. The time now is 08:27 AM.

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"