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



--
For den, der kun kender en hammer,
komme alle problemer hurtigt til at ligne søm.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default Before_Print event

And this was empty :-(

Anyway

I need som code to change interior colors before print, and reset them
after.

I have tried something like this on the Before_Print Event

Range("A1").Interior.ColorIndex = xlNone
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Range("A1").Interior.ColorIndex = 6

The problem is, that the sheet is printed twice, onece without the
background color, and once with it.

If I add

Cancel = True, nothing is printed at all.

Jan





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Before_Print event

Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet
Application.EnableEvents = False
Range("A1").Interior.ColorIndex = xlNone
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Range("A1").Interior.ColorIndex = 6
Cancel = True
Application.EnableEvents = True
End With
End Sub

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Jan Kronsell" wrote in message
...
And this was empty :-(

Anyway

I need som code to change interior colors before print, and reset them
after.

I have tried something like this on the Before_Print Event

Range("A1").Interior.ColorIndex = xlNone
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Range("A1").Interior.ColorIndex = 6

The problem is, that the sheet is printed twice, onece without the
background color, and once with it.

If I add

Cancel = True, nothing is printed at all.

Jan







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default Before_Print event

Thank you very much.

Jan

Bob Phillips wrote:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet
Application.EnableEvents = False
Range("A1").Interior.ColorIndex = xlNone
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Range("A1").Interior.ColorIndex = 6
Cancel = True
Application.EnableEvents = True
End With
End Sub


"Jan Kronsell" wrote in message
...
And this was empty :-(

Anyway

I need som code to change interior colors before print, and reset
them after.

I have tried something like this on the Before_Print Event

Range("A1").Interior.ColorIndex = xlNone
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Range("A1").Interior.ColorIndex = 6

The problem is, that the sheet is printed twice, onece without the
background color, and once with it.

If I add

Cancel = True, nothing is printed at all.

Jan



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
apply cell change event to single column - WorksheetChange Event [email protected] Excel Programming 6 May 4th 08 02:28 AM
Before_Print Robin Clay Excel Programming 2 February 13th 07 12:41 PM
before_print does not work - f8 key does not do anything Nasim Excel Programming 2 December 4th 06 02:03 AM
Before_Print JMay Excel Programming 10 November 12th 06 06:27 PM
Re-Post: Before_Print Sub Doesn't Trigger Phil Hageman[_3_] Excel Programming 27 March 4th 04 04:03 AM


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