MACRO TO COUNT ALL OPEN WORKBOOKS and print

I need to know if there is a way i can run a macro to count all open 
workbooks and print "sheet1" of all open workbooks. The macro should close 
each workbook after printing the first sheet.
0
Utf
5/11/2010 5:31:01 PM
excel.programming 6508 articles. 2 followers. Follow

1 Replies
766 Views

Similar Articles

[PageSpeed] 43

Hi

Here's a way

Sub aaa()
For Each wb In Application.Workbooks
    wb.Sheets("Sheet1").PrintOut
    wb.Close savechanges:=True 'Or false
    counter = counter + 1
Next
msg = MsgBox(counter & " sheets has been printed", vbInformation + vbOKOnly)
End Sub

Regards,
Per

"JOSEPH WEBER" <JOSEPHWEBER@discussions.microsoft.com> skrev i meddelelsen 
news:579425C9-2EDF-437E-BB0B-2B59CA7CFDE5@microsoft.com...
> I need to know if there is a way i can run a macro to count all open
> workbooks and print "sheet1" of all open workbooks. The macro should close
> each workbook after printing the first sheet. 

0
Per
5/11/2010 6:05:29 PM
Reply:

Similar Artilces:

Count fields and show names
Hello all, I have an excel spreadsheet that has 5 fields (cells-HIP, WAIST, ARM, LEGS, HEAD) each with a value of 1 or 0 (True or False) I need a formua to count the 5 fields and if there are 3/5 that are 1 (True) then fill a new cell (Total) with 1(True), if there are less than 3 fields, then False (0). But would it also be possible to show which fields, along with the value of 1 or 0, were true and which were false? For example, 3/5 fields--->True False HIP, WAIST, HEAD ARMS, LEGS Thanks a million for you time! Hi slagg - the first part is simple in the tot...

Counting Nulls
I have a query that I am trying to count how many times a record appears in a field. The issue is there are some where the record is null, and it won't count these. Is there a way count nulls, or give the nulls a value? I'm a bit confused by the terminology... A "record" in Access is the entire row in the table, with all the fields. A "record" would not "appear in a field". Thus, a "record" could not be null, as this would imply that there was no record. If you have a field that may contain a Null, you could use a query and create a n...

count between dates help (NETWORKDAYS)
Hello big brains I am trying to find the days and hours between 2 dates 2 columns of dates formated in M/D/YYYY hh:mm 4/23/2004 15:53 and 4/27/2004 10:43 I don't want to count weekends so I used NETWORKDAYS which works to a degree.. giving me 3 (which is days) but it's ignoring the time. I need it to be specific and have it show days and hours difference. I am suprised that it is ignoring it. Unfortunately I am kind of stuck with the dat being in this format. Any help would be appreciated. thanks Maybe this can give you some ideas http://www.cpearson.com/excel/DateTimeWS.ht...

running macros #2
Hi, I have created a macro that imports data, sorts it, and delimits it. The macro in itself works just fine, however trying to run it a second time on a different file causes it to blow up. Prior to importing the data, I clear out the old contents so it doesn't prompt me to overwrite, the re-run of the macro WILL prompt me, and rather than overwrite, it appears to insert instead, and therby causes it to trash the existing data. I'd sure appreciate any help here. Thx. Without seeing your code, it's nearly impossible to tell. In article <58725910-CF96-4589-8CF0-76ADF515E2...

count decimal place
I want to query a field for more than 3 decimal places. A ..23 1.56 49.34534 7.434 I want 49.34534 to be the only result. Any thoughts? SELECT MyField FROM MyTable WHERE (Len(MyField) - InStrRev(MyField, ".")) > 3 -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "samuel" <samuel@discussions.microsoft.com> wrote in message news:B513BEA8-8FB3-4471-ACB9-0D1D5FE4A117@microsoft.com... > can you expound for me? > > "KARL DEWEY" wrote: > >> Convert to string and using InStrRev count to find pe...

Print Macro #4
Hello I would like to write a macro, for a particular workbook, which is activated when you select File/Print/OK (the macro will check to see if certain conditions are met and will print if they are but will return an error message if they are not). Can anyone suggest the code required? Thanks in advance Nick There's a workbook event that you can tie into. Rightclick on the excel icon (to the left of the File option on the worksheet menu bar). Select view code and paste this in the code window: Option Explicit Private Sub Workbook_BeforePrint(Cancel As Boolean) If LCase(Me.Wo...

Excel cannot open email program.
I often use "file.. send to... mail recipient" to send a spreadsheet as text in the body of an e-mail. I prefer that to sending excel as an attachment, since my recipients may not have excel and usually don't need to see formulas. On my new computer however I get the message "excel could not open the e-mail program" if I try the first option above. Both excel 2002 and outlook 2002 are working fine. I "repaired" office just to be sure. Still doesn't work. Only difference is that the computer came with a trial version of office 2003 which I don...

How do I assign a shortcut key to an existing macro in Excel 2003.
ntahall, Alt+F8 to bring up the choose macro box, select your macro, options, assign a shortcut from there -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2000 & 2003 ** remove news from my email address to reply by email ** "ntahall" <ntahall@discussions.microsoft.com> wrote in message news:21B6102C-4B88-4131-A9AC-C48879896A17@microsoft.com... > ...

Report Not Printing
We are running version 3.0 of CRM and I have one workstation that cannot print reports presently. My workstation works fine so far it seems only isolated to the one workstation. What happens is they get the report up on the screen but when they hit the print button they get an error on page. The details on the error are similar to below. Line: 20 Char: 4 Error: Object doesn't support this property or method Code: 0 URL: http://ddcrm/ReportServer?%2fDesigner+Doors_MSCRM% 2fCustomer+Acceptance+Resolved+Issues&Resolveddate=10%2f1% 2f08&rs%3aCommand=Get&rc% 3aGetImage=8.00.1...

Why is Publisher printing very light, hard to read, after reinstal
I had to reload my Microsoft Office 2000 and now the print on my Publisher documents is very light and hard to read. How do I change this to a darker look? Betty FLorida This is not a Publisher issue. Do you have your printer set to draft? Is your driver current? Clean your printer heads. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Betty Florida" <Betty Florida@discussions.microsoft.com> wrote in message news:331DD522-35D0-4448-9DA8-744A74476E25@microsoft.com... >I had to reload my Microsoft Office 2000 an...

Outlook print size
When I print e-mails from outlook express to my HP deskjet, the print size is extremely small. How do I increase the size of the print? ...

How to print greeting card envelopes
Using publisher 2003. I can print greeting cards just fine, however I can't find the right page set up to print the envelopes. Measure your envelope and input those measurements into your printer setup and then in the page setup. -- Mary Sauer MS MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "motownretiree" <motownretiree@discussions.microsoft.com> wrote in message news:40755C3E-3ABD-407B-AC22-B2744C7EC409@microsoft.com... > Using publisher 2003. I can print greeting cards just fine, however I can't > find the right p...

Conditional Opening of Excel file
Hi, I have a complex workbook that relies on various SUMIF's from othe reference workbooks. If these aren't open, then obviously the formula don't work. As it's for someone else; I want a piece of VB so that when they *open the main workbook, it checks to see if the ref file is open, and i not, it automatically opens it for them. A bit like this sub worksheetopen '(Not sure where this should go in parent book) if workbook("Referencefile.xls") is NOT open then workbook("referencefile.xls").open endif endsub Any ideas folks?:confused -- Message p...

Trouble opening publisher docs from CD
I burned a CD containing publisher documents (all were changed from read only)for a associate to use. However, when the associate put in the CD, he could open the documents, but could NOT make any changes or additions. A box comes up stating something about "hidden" atributes or something like that. He also copied the entire folder into his computer and still couldn't make any changes or additions to the individual documents. What are we doing wrong. I appreciate any help to resolve this problem and thank anyone who may have the answer. Once those publications ar...

Place a button on a worksheet and assign a macro to it?
How do I place a single "button" on a worksheet (say, in one cell), and assign a macro to it? Hi, Choose View, Toolbars, and pick the Forms toolbar. Click the Button tool and then click in the spreadsheet. You will be prompted for the macro you want to assign. You can resize and move the button after assigning the macro. If this helps, please click the Yes button Cheers, Shane Devenshire "PFB" wrote: > How do I place a single "button" on a worksheet (say, in one cell), and > assign a macro to it? I often use shapes from the drawing tool bar. O...

Limit record count in query
Hello all, I have a query that will return over 65K records (rows). My end goal is to export this to Excel via code. Excel has a limit of 65K rows on a single tab. So, 65K to tab1, the rest of the records to tab2. I figured I would have query1 that would limit the results to 65K, and query2 that would start at 65K +1 to the end. How can I limit query1 to 65K and query2 to start at 65K +1? I'm not sure how efficient this will be but you could try: SELECT TOP 65000 * FROM [query that will return over 65K records] ORDER BY PrimaryKeyField; and SELECT * FROM [query that will retu...

Count function #2
I have in Several Columns a list of Customer Names and for each column I would like to do a Count of how many in each column but when I do =Count(B2:B33) it returns a 0 and should return 4 Does a Count not work on text? Thanks! Hi, =Counta(B2:B33) if this helps please click yes, thanks "H" wrote: > I have in Several Columns a list of Customer Names and for each column I > would like to do a Count of how many in each column but when I do > > =Count(B2:B33) > > it returns a 0 and should return 4 > > Does a Count not work on text? > > Tha...

open multiple workbooks at startup
Ever since i ran a macro that opened several workbooks, my Excel always opens the same workbooks. I have searched and deleted all the files that are being opened. Search shows they are in a sub-folder "Application Data", but this folder is not listed in explorer and the files that are opened are not found with a file search. another thing, the open files in Excel options is cleared to blank. How do I stop opening these files when I open another file? Dear Ron, you can find the folder application data if you switch on the view hidden files option in windows it will be in C:...

Font size changes in Excel 2003 charts when re-opened
For certain charts that I create within Excel 2003 (usually bar charts), I use a font size of 8 (eg for data labels, axis labels, and scale). If I close the file and then re-open it, all these fonts will have become size one (title and legend are not effected). Oddly, if I have created a bar chart and made several copies of it within a worksheet, it will only be the original and not the copies that are affected by this. If anyone can shed any light on why this may be happening and how it could be fixed, I would really appreciate it. Lucie ...

How do I use a pivot table to get an average count? #2
I have a list of transactions with colum headers of Month, Date, Weekday, Time and the transaction data. I would like to see the average number of transaction per hour per day. Can this be done in a pivot table? ...

PLEASE HELP!!!!! MAcro Emergency
maybe now someone will help me?? noone has responded to my last 2 post so I am trying to figure it out myself, am trying to build a macro an need to select RELATIVE REFERENCE before I record it, that "sto recording" toolbar was there the first time i tried to record the macr with the button to select relative reference but now every time i try t record the macro that toolbar isnt there anymore and the macro wont wor unless i can first select relative reference, please help before i tak the sledge to this computer PLEASE!! -- RalphS -------------------------------------------------...

unable to open CRM web page
It seems that I can open the CRM web page from the server but not from any workstations. It also affected any clients that were using the Outlook client. I have tried opening the page using the ip address, and the FQDN of the the server and still didn't have any luck. Someone point me in the right direction. Hi Flip, Well a few things to try to narrow the problem down: 1. Can you ping the server with the IP address / FQDN? 2. Can you log into the server with a non administrator and get to the site locally? (may be a permission issue, set to run as local or network service) 3. Log...

Printing Email in Outlook from Publisher
We are sending a publisher document as an email message. When it arrives in Outlook and we try to print the email, it elects to become hundreds of pages except it is only 5. Thank you. ...

Printing without white borders
I am trying to print from Power Point. Slide has a Blue backround. When ever I print it on a white page, preview/print shows a white boarder. I have tried selecting scale to fit paper, it reduces that white boarder but still there. How can I print whole page with Blue backround? Thanks its a printer issue, not a powerpoint issue. You need a printer capable of bleed 4 sides, or print on larger paper and trim! Randy Munish wrote: > I am trying to print from Power Point. Slide has a Blue backround. When ever > I print it on a white page, preview/print shows a white board...

Open XML File Converter
Version: 2004 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Any word on an update to this converter that resolves the "There is not enough memory or disk space to convert this document" bug on SL? I've seen it reported elsewhere so I'm assuming it's a known issue, but can't find any relevant info here. Thanks. On 11/2/09 2:33 PM, in article 59b7fd3a.-1@webcrossing.caR9absDaxw, "elliotcolbert@officeformac.com" <elliotcolbert@officeformac.com> wrote: > Any word on an update to this converter that resolves the "There is not e...