Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem w/ Print Macro
I a bit of a beginner at VBA so bear with me a bit. I removed the cancel=true
and I got the dialog box back for printing. Only problem is that now the code to whiteout cell C4 in "sheet 1" no longer works. If I am in any other worksheet (I have a print button on sheet2 as well) the button works fine. Must be because the whiteout macro disables the print dialog box event only on sheet1 and forces a straight to default printer. Is there code that mimics a quick print rather than trying to pull up the dialog? That might fix this. Thanks. The "Jim Thomlinson" wrote: Sorry I missed the .printout What part is not working... Are your events enabled. If at any point during debuggin you stopped the code prior to Application.EnableEvents = True Then your events are not firing... -- -- HTH... Jim Thomlinson "Jim Thomlinson" wrote: The line Cancel = True Cancels the print job. it does not sound like that is your intention. Try removing that line... -- HTH... Jim Thomlinson "dgold82" wrote: I have 2 macros one for showing the print dialog (connected to a clipart image of a printer) and the other to white out certain cells before print so that they don't show. For some reason the print macro no longer works now that I put in the before print macro. Any ideas? Fix? Here is my code below: (I am running excel 2003, code below is in "thisworkbook") Sub PrintSheet() Application.Dialogs(xlDialogPrint).Show End Sub Private Sub Workbook_BeforePrint(Cancel As Boolean) If ActiveSheet.Name = "sheet1" Then Cancel = True Application.EnableEvents = False Application.ScreenUpdating = False With ActiveSheet .Range("C4").Font.ColorIndex = 2 .PrintOut .Range("C4").Font.ColorIndex = 1 End With Application.EnableEvents = True Application.ScreenUpdating = True End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro Print Range Problem - Rows Cut Off (Upgraded From Excel 2003 to2007) | Excel Programming | |||
Print preview from macro problem | Excel Programming | |||
Print Macro Problem | Excel Programming | |||
Print Macro Problem | Excel Discussion (Misc queries) | |||
Pivot Table macro to set print area and print details of drill down data | Excel Discussion (Misc queries) |