Author Topic: System Print event  (Read 6026 times)

0 Members and 1 Guest are viewing this topic.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
System Print event
« on: March 12, 2008, 03:34:45 PM »
Does anyone know if it is possible to intercept an end_print event using a system printer?

I have several spreadsheets that are printed regularly, but there is alot of the information that is not required and is not desired on the printed page. I can successfully hide the crap, but I need it turned back on after the printing is completed .. any ideas?
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: System Print event
« Reply #1 on: March 12, 2008, 03:42:21 PM »
in excel?  Turn on the macro recorder and see if you can find anything there maybe?
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

FengK

  • Guest
Re: System Print event
« Reply #2 on: March 12, 2008, 07:16:15 PM »
Too bad excel only has WorkbookBeforePrint event, but no WorkbookAfterPrint. Maybe use WMI to monitor the printer que?

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: System Print event
« Reply #3 on: March 12, 2008, 07:28:41 PM »
in excel?  Turn on the macro recorder and see if you can find anything there maybe?

There is nothing after the begin_print event ... I'll have to see if I can find another way .. perhaps as Kelie said .. hook into the system and monitor the printer que .. but then it might kick in for something printed concurrently .. I'll have to think on this a bit more.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Joro--

  • Guest
Re: System Print event
« Reply #4 on: March 13, 2008, 05:59:20 AM »
Hi Keith,

I guess you can use a macro which will be started manually after printing which will unhide all hidden rows and columns. If there are some hidden rows and columns you don't want to treat you can have another manually started sub before printing to register initially hidden columns in some public array variables. Then the second sub after printing will not unhide the initially hidden rows and columns.

Dave R

  • Guest
Re: System Print event
« Reply #5 on: March 13, 2008, 08:19:28 AM »
Does anyone know if it is possible to intercept an end_print event using a system printer?

I have several spreadsheets that are printed regularly, but there is alot of the information that is not required and is not desired on the printed page. I can successfully hide the crap, but I need it turned back on after the printing is completed .. any ideas?

Couldn't you just unhide the information after looping and printing? I'm guessing here, but shouldn't the PrintOut method only print what you have setup? After you have called the PrintOut method on each sheet with the information hidden I would think you could just loop back around and unhide the columns/rows you need to see again.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: System Print event
« Reply #6 on: March 13, 2008, 08:58:25 AM »
Except I don't call the PrintOut method ... I suppose I could ... but how to implement it would be key
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Dave R

  • Guest
Re: System Print event
« Reply #7 on: March 13, 2008, 03:12:32 PM »
Except I don't call the PrintOut method ... I suppose I could ... but how to implement it would be key

So how are your printing the worksheets now? Are you using the Windows API? If so then the EndDoc method would probably be the key to unhiding the information.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: System Print event
« Reply #8 on: March 14, 2008, 08:13:47 AM »
Currently the user clicks the printer icon in the excel application, or selects the "print preview" item from the menu and prints from there.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Dave R

  • Guest
Re: System Print event
« Reply #9 on: March 14, 2008, 08:21:03 AM »
Are you looking to automate the process for the group of spreadsheets you need to print or would each spreadsheet be printed on an ad hoc basis?

Chuck Gabriel

  • Guest
Re: System Print event
« Reply #10 on: March 14, 2008, 08:27:33 AM »
You could maybe figure out if Excel posts something to its message queue at the end of printing by watching the messages that are posted during a typical print cycle using something like the Spy++ tool that comes with older versions of MSVC++.  Then you could subclass the window and process that message yourself.  Trying to figure out what all those messages mean can be a witch with a capital B though.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: System Print event
« Reply #11 on: March 14, 2008, 09:03:36 AM »
Are you looking to automate the process for the group of spreadsheets you need to print or would each spreadsheet be printed on an ad hoc basis?

Let me give you some information about what we are doing so you can understand what we are trying to do. We have a dozen or more sheets that are filled in with various information. Some of these spreadsheets have hundreds of input locations, we could possibly use some of them, perhaps all of them, but mostly we only use half a dozen or so at any given time.
The spreadsheet, if printed as it is, takes 3 pages, but much of that information is unused for any given printout. We already have options the user can select to hide/show the portions of the spreadsheet not used, when we do this, the printout fits nicely on a single page, exactly what we want. However, now we wish to make it a little less painful by automating the hiding and showing of the portions of the sheet not used.

Process:
User fills in the required fields and prints the spreadsheet.
Print events should hide the unused components, print the single page, show the hidden components for the next use.

You could maybe figure out if Excel posts something to its message queue at the end of printing by watching the messages that are posted during a typical print cycle using something like the Spy++ tool that comes with older versions of MSVC++.  Then you could subclass the window and process that message yourself.  Trying to figure out what all those messages mean can be a witch with a capital B though.

Agreed .. and I could sublcass Excel, but I don't have the time to devote to sorting the messages right now
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Dave R

  • Guest
Re: System Print event
« Reply #12 on: March 14, 2008, 12:44:32 PM »
Process:
User fills in the required fields and prints the spreadsheet.
Print events should hide the unused components, print the single page, show the hidden components for the next use.

Seems to me you could do this quite easily by having a button on the sheet (or in toolbar) that runs a macro to hide the information you don't want to see, setup and print the spreadsheet, then unhide the hidden information. Once you send the formatted information to the printer using the Worksheet.PrintOut method you have effectively sent a snapshot of the information you want to the printer. At that point I would think it would just be a matter of unhiding the hidden information.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: System Print event
« Reply #13 on: March 14, 2008, 01:11:42 PM »
yeah, but retraining idiots is another thing entirely
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Dave R

  • Guest
Re: System Print event
« Reply #14 on: March 17, 2008, 12:39:24 PM »
yeah, but retraining idiots is another thing entirely

 :lmao:

Amen to that.