Trapping Print event in excel vba

Hi,

I'm trapping the App_workbookbefore Print Event which is working
wonderfully!

See http://www.cpearson.com/excel/AppEvent.aspx

But The Question I've got is it possible to return what sheet, if only
one sheet is printed or sheets if multiple sheets are printed.

0
jj1201 (2)
10/22/2007 11:38:34 AM
excel 39879 articles. 2 followers. Follow

2 Replies
360 Views

Similar Articles

[PageSpeed] 12

You can return the sheets selected like this:

Sub ShowSelectedSheets()
    Dim Sh As Worksheet
    For Each Sh In ActiveWindow.SelectedSheets
        MsgBox Sh.Name
    Next
End Sub

but if the user chose to print 'Entire workbook' instead of the default 
'Active sheet(s)' I'm not sure you can detect that.

-- 
Jim
"JJ" <jj@cwgsy.net> wrote in message 
news:1193053114.825663.72450@z24g2000prh.googlegroups.com...
| Hi,
|
| I'm trapping the App_workbookbefore Print Event which is working
| wonderfully!
|
| See http://www.cpearson.com/excel/AppEvent.aspx
|
| But The Question I've got is it possible to return what sheet, if only
| one sheet is printed or sheets if multiple sheets are printed.
| 


0
jrrech (1933)
10/22/2007 1:27:25 PM
Thanks for the reply,

Getting the current sheet etc is nice and simple like you say, Its the
what ifs thats the problem.

Again the user could select all workbook, or a number of sheets.

Anyone know if getting the sheets printed is possible, Or a after the
print options screen comes up Event?

0
jj1201 (2)
10/23/2007 7:15:55 AM
Reply:

Similar Artilces:

Very annoying behaviour of Excel 2003
Each time I am opening Excel, it is installing some component. This takes several minutes, and becomes very annoying. I recently had to reinstall XP and Office from the distribution CDs. I have the problem since then. It certainly has something to do with the install. Does anyone on this forum ever experienced such a behaviour. I am running Office 2003 on XP SP3. have you tried doing a repair in the help menu? -- Gary Keramidas Excel 2003 "Jean" <Jean@discussions.microsoft.com> wrote in message news:020549D4-8070-46ED-8768-821EECD87C88@microsof...

My hide sheet option in excel is not working
My hide sheet option in Excel is not working. It is grayed out so I can not toggle nor use it to hide or unhide sheets. Security is at Medium - would appreciate any insight into how to fix this. Is the sheet protected? You cannot hide a protected sheet. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "arleen" <arleen @discussions.microsoft.com> wrote in message news:D028B90F-6DDB-4DE6-9F5C-22C137FBE927@microsoft.com... > My hide sheet option in Excel is not working. It is grayed out > so I can not > toggle n...

How do I get excel to accept (c) as text and not change to copyri.
How do I enter the text (c) in Excel without having it changed into the copyright symbol? Hi Daffyd, Try: Tools | Autocorrect | Select (c) | Delete | OK --- Regards, Norman "daffyd" <daffyd@discussions.microsoft.com> wrote in message news:8CCC3C1A-6F19-4F62-B934-8A71F236A4FD@microsoft.com... > How do I enter the text (c) in Excel without having it changed into the > copyright symbol? Go into the Tools Menu. Look for AutoCorrect. In the bottom half of the AutoCorrect Tab, look at the list for Replace text as you type. Delete the entry for (c). tj "da...

Setting series values on Excel Chart
Hi I'm struggling very hard in getting beyond this error when trying to use VB to generate a chart from data previously inserted into the sheet. Unable to set the Values property of the Series class. The code works absolutely fine in XL2007 but I am having to port it back to 2003 and the inference is that its empty values that cause it to hiccup - something I cannot avoid. My code is: 1. Retrieve selected data from database and place it at the top of the sheet 2. Add The Chart 3. Iterate through the data (amount can be variable depending upon user inputs) For j as i...

Excel template that lists each month's meetings w/ some detail
I'm looking for an Excel template that lists every month of the year with room to list weekly, monthly and quarterly meetings, including some detail for each meeting. Probably would need to be landscape oriented. The main intent is to give the person using it an idea of upcoming meetings, the intent of each and what prep is required. ...

How do I make a 'box and whisker plot' graph in Microsoft Excel?
I am in Year 12 and am doing a stats assignment. The project states that i MUST insert a box and whisker plot for some data, but i don't know how to do this. Does anybody know? Hi, Here are some sites on the topic of stats charting not just box and whisker. http://peltiertech.com/Excel/Charts/statscharts.html http://www.processtrends.com/toc_statistical_charts.htm http://tushar-mehta.com/publish_train/data_analysis/16.htm http://people.stfx.ca/bliengme/ExcelTips.htm Cheers Andy -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info "Year 12 student who needs help" &...

I've got a formula for stones and pounds
Hello, I've got a column that displays a series of weights in stones & pounds (both in the one cell). How do I get a chart to recognise and display in the same format? Regards, mikelenno What is the format of the cells with stone & pounds It is best to enter such values a 10 3/14 and format the cells with # ??/14 best wishes from one who is INT(275,14) stone & MOD(250,14) lbs -- Bernard V Liengme www.stfx.ca/people/bliengme remove caps from email "mikelenno" <mikelenno@discussions.microsoft.com> wrote in message news:5AD608FA-5367-4CED-AD76-1F54228EFDBA...

Printing Multiple Receipts at a Time From Journal
Hey guys, Is there a way to print multiple journaled receipts at a time? Say all receipts for a batch or by date or other criteria? Thanks Tom, Not that I've seen. -- = Get Secure! - www.microsoft.com/security You must be using Outlook Express or some other type of newsgroup reader to see and download the file attachment. If you are not using a reader, follow the link below to setup Outlook Express. Click on "Open with newsreader" under the MS Retail Management System on the right. http://tinyurl.com/75bgz ========== "Tom Bombadill" <Genius_pos...

Computer Check Printing
Computer Checks Edit List is for a check run for one country (all the vendors in that countrY), but the vendors from another country show up as zero dollars. Any idea how to prevent this? It does not appear to be related to KB# 874437, as electronic payments are not used. Thanks in advance. ...

how to query my web site from VBA and return a value to VBA
Hello All, From VBA I would like send a value to my web site, and have it return a value. I've learned how to use FollowHyperlink to send a value to an ASP script, but how can the ASP script send a value back to VBA?? Thanks, Brian Austin, TX You can use xmlhttp to make a request to your web page: '********************************************************* Sub Tester() MsgBox WebResponse("http://www.mydomain.com/myactualpage.asp? info=3Dblah") End Sub Private Function WebResponse(sURL As String) As String Dim XmlHttpRequest As Object Se...

Printing Multiple Copies #4
Hi all - I am using Vista Business and Publisher 2007 from the Office 2007 Small Business package. No matter what type of publication or template I use I can only print single copies. Most recently I tried to print 30 copies of a single page flyer and had to do it a single copy at a time. If I go to File|Print and set the number of copies to 30, I still get a single copy only. Does anyone have any thoughts? Thanks -- Andrew Aitchison (amhsn@nospam.sympatico.ca) Is your printer driver current? What is the default in the printing preferences in the control panel printer folder? ...

Outlook 2003: Print address book
I'm running Outlook 2003 as a stand alone program without a network. I can't print the address book. The address book menu does not offer any print options including those found in the Help and Support and the MS Knowledge Base. It also doesn't offer the option to export/import. What am I missing here? Operating Windows XP Home SP2, IE 6 SP2, Outlook 2003. Thanks for any suggestion -- Phil pdischert@iname.com There is no address book in Outlook. There are lots of choices for ways to print your Contacts Folder: http://www.slipstick.com/contacts/print.htm -- Russ V...

why do changes only save locally on networked excel file?
why do changes only save locally on networked excel file? ...

Article published by Microsoft reg. 'Event' custom entity
Recently, I found a great article published by Microsoft that contains a sample code on how to create a custom entity, event. I thought that I bookmarked it but cannot find it. Has anyone seen it and can provide a hyperlink? I will really appreciate it. http://msdn2.microsoft.com/en-us/library/aa682866.aspx you'll probably find it in the above link "mkatsev" wrote: > Recently, I found a great article published by Microsoft that contains a > sample code on how to create a custom entity, event. I thought that I > bookmarked it but cannot find it. Has anyone seen...

Excel problem #3
I am attaching an excel file where i have a problem In the file are 2 sheets, Main & second I want to get data from second sheet to the main sheet by a formula by which the amount in the total column will be posted in the second sheet falling under various dates. I have done for 6 sept 2003 by way of example I do not know any formula by which i can do this automatically Please help me Attachment filename: example.xls Download attachment: http://www.excelforum.com/attachment.php?postid=444742 --- Message posted from http://www.ExcelForum.com/ Hi one way: ...

Excel formulation to automate values
Hi there, I have a little problem on arranging a small multi-worksheet excel here. Let me explain in a short way then give some details on it. I am trying to make an offers recordsheet which has two worksheets in it. One for products(and their base prices) and an offer sheet. I would like to use a bit dynamic data here. So when I type the name of the product excel would give me the price from other worksheet. in details; Prices worksheet is something like: A B 1 Product BasePrice 2 mouse 5 3 keyboard 8 4 ... And the ...

Removing hidden mailto:s from Excel?
I received a spreadsheet attachment yesterday and found a mailto:(my address) embedded in a cell under a text string. It was evident in a tooltip that appeared when cell was hovered-over. I told the sender who now says that many of her spreadsheets - used to handle group memberships - have such hidden addresses. What terms would she use to search for these pests, either in My Docs or on opening each sheet? ...

Using Excel in Mac office 2004 with Microsoft/Mac 2008:Analysis toolpack
Although I am disappointed with Office 2008 for Mac because of the absent of Analysis toolpack, I figured things out quite recently that I can still install my Mac office 2004 and use the excel package that contains the Analysis tool pack. How? ...... let me show you: 1. Insert your CD for Mac office 2004 2. When it open on your desk top, two options will be given to you to download the software (a) Office set-up assistant, and (b) Microsoft office 2004. 3. CHOOSE MICROSOFT OFFICE 2004 (Drag the icon onto your desk top) and it will start to run/download. 4. When done, this will appear as ...

Printing Word and excel documents via excel vba
I have a document that has some Excel and some word content i would like to use excel vba to print both a page from word and then a page from excel. I know how to select and open the word document, however i cant find any code to print page X from word. basically i need to: print page 1 of c:\xx\document1.doc print page1 of sheet1 of c:\yy\excelwkbk1.xls print page 2 of c:\xx\document1.doc print page2 of sheet1 of c:\yy\excelwkbk1.xls and so on it will require moving between word and excel - the excel bit i get, but getting back to excel from word, and printing out in word is slightly more...

Using Excel spreadsheet as input to Access
Hello, I posted this in the New Users forum but only got one answer, so thought I'd try here as well. Like so many others, I am an Excel newbie. I was a mainframe COBO programmer in another life, but that was a few years back My manager would like me to write an app that will take tracking dat from an existing Excel spreadsheet (generated by our system) but onl use a select handful of columns as input to a new Access database tha I will create. I'm guessing that I can either a) create a new edited spreadsheet to b used as input to the Access database or b) use the Import wiza...

force excel to run in only one process excel.exe
force excel to run in only one process excel.exe, excel seems to want to make multiple excel.exe loaded into memory which causes mysheet.copy to fail so i have to close out the xls, kill all running excel.exe, then run the xls again and the macro works. i only have to do this when i am actively debugging a lot. if i just run my macro w/o opening the vba debugger, i can run it as much as i want, but if i run with break points it crashes a lot because of multiple excel.exe loaded into memory. perhaps there is a way i can force excel to only load one excel.exe? Daniel, Are you using Automatio...

Excel not displaying German characters correctly.
This is a real puzzler. Has our entire office and IT department stumped. We have two machines (M1 / M2) which are equal spec/ operating system, applications, versions, etc... The only difference that we can see between the two machines is that one (M1) has Internet Explorer encoding set to "UTF-8" with "Automatic" selected. The other (M2) has "Western European ISO" with no automatic selected. Now, when the machines log into a web application and choose to download a German Excel file, M1 and M2 get the file correctly if they have their encoding settings...

MS Excel Paste Special>Paste All
Using MS Excel 2003 Paste Special> Paste All, doesnt quite paste the 'Column Widths'. Am I always required to do the two step dance, Paste Special> Column Widths and Paste Special>All. >>Am I always required to do the two step dance Yes<g>. -- Jim "Excel User" <Excel User@discussions.microsoft.com> wrote in message news:5D34ED9D-5BD6-43AD-8773-1EB7229309B2@microsoft.com... | Using MS Excel 2003 | | Paste Special> Paste All, doesnt quite paste the 'Column Widths'. Am I | always required to do the two step dance, Paste Special> ...

Print Vertical Banner in Pub 2000
Is it possible to print a vertically oriented banner with Publisher 2000? I have made many horizontally oriented banners, and would like to attempt a vertically oriented one. Any tips? Help... ...

Print from Outlook to Avery Rolodex Cards
I am unable to find any way to print my Outlook contacts list on Avery Small Rotary Cards #8385. Please advise. And thanks much. S ...