Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default BeforePrint macro difficulties

I've looked over several other posts regarding BeforePrint macros, and it
appears I've written my macro properly, but it won't execute as I expect. I
already have an Auto_Open subroutine that performs properly, and all I want
is for Excel to execute the same procedural steps --- presetting specific
cells --- whenever I print. I must be overlooking something in the
procedure(s) or Event(s)?

Here's the two subs:

Sub Auto_Open()
Range("Password") = ""
Range("SwitchShow") = 0
Range("ONOFF") = 0
End Sub


Private Sub Workbook_BeforePrint(Cancel As Boolean)
Range("Password") = ""
Range("SwitchShow") = 0
Range("ONOFF") = 0
End Sub



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default BeforePrint macro difficulties

I've looked over several other posts regarding BeforePrint macros, and it
appears I've written my macro properly, but it won't execute as I expect. I
already have an Auto_Open subroutine that performs properly, and all I want
is for Excel to execute the same procedural steps --- presetting specific
cells --- whenever I print. I must be overlooking something in the
procedure(s) or Event(s)?

Here's the two subs:

Sub Auto_Open()
Range("Password") = ""
Range("SwitchShow") = 0
Range("ONOFF") = 0
End Sub


Private Sub Workbook_BeforePrint(Cancel As Boolean)
Range("Password") = ""
Range("SwitchShow") = 0
Range("ONOFF") = 0
End Sub


BTW, once I get this macro working, will it work for File Print Preview?
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default BeforePrint macro difficulties

Or maybe you don't have it in the right module. It goes in the ThisWorkbook
module.

Keep Auto_open in a General module, though.

And yep, print preview will fire the _beforeprint event.

SchneidRL wrote:

I've looked over several other posts regarding BeforePrint macros, and it
appears I've written my macro properly, but it won't execute as I expect. I
already have an Auto_Open subroutine that performs properly, and all I want
is for Excel to execute the same procedural steps --- presetting specific
cells --- whenever I print. I must be overlooking something in the
procedure(s) or Event(s)?

Here's the two subs:

Sub Auto_Open()
Range("Password") = ""
Range("SwitchShow") = 0
Range("ONOFF") = 0
End Sub

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Range("Password") = ""
Range("SwitchShow") = 0
Range("ONOFF") = 0
End Sub


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default BeforePrint macro difficulties

THAT was the ticket, Dave! Even at 56, ya learn something new every day!
I've got all sorts of modules, with various subroutines. Since the
particular spreadsheet on which I'm working originally dates back several
years, I'm guessing that I must've created a new module whenever a new macro
popped into my head(?)

Thanks a heap!

"Dave Peterson" wrote:

Or maybe you don't have it in the right module. It goes in the ThisWorkbook
module.

Keep Auto_open in a General module, though.

And yep, print preview will fire the _beforeprint event.

SchneidRL wrote:

I've looked over several other posts regarding BeforePrint macros, and it
appears I've written my macro properly, but it won't execute as I expect. I
already have an Auto_Open subroutine that performs properly, and all I want
is for Excel to execute the same procedural steps --- presetting specific
cells --- whenever I print. I must be overlooking something in the
procedure(s) or Event(s)?

Here's the two subs:

Sub Auto_Open()
Range("Password") = ""
Range("SwitchShow") = 0
Range("ONOFF") = 0
End Sub

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Range("Password") = ""
Range("SwitchShow") = 0
Range("ONOFF") = 0
End Sub


--

Dave Peterson

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
Print preview error from BeforePrint macro LauriS Excel Discussion (Misc queries) 1 December 6th 07 12:06 AM
BeforePrint help Rookie 1st class Excel Programming 4 November 19th 05 09:57 PM
BeforePrint macro Steve O Excel Discussion (Misc queries) 4 September 21st 05 01:09 AM
Macro syntax difficulties (long post) RAP Excel Programming 6 August 5th 05 08:50 AM
BeforePrint Add In Daniel McCollick[_2_] Excel Programming 10 June 10th 05 08:07 PM


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