Print Current Page Only Macro

I am trying to come up with a macro with the ability to print th
current page.  It has become a big need within my company and will b
a real time saver.  Is there a way to search for the active cell an
then print the current page it is in?  In other words, by placin
your cursor on the page you want to print, you could then run th
print current page macro

0
2/4/2004 8:20:55 AM
excel.newusers 15348 articles. 2 followers. Follow

4 Replies
447 Views

Similar Articles

[PageSpeed] 21

Hi
SUB print_current()
    ActiveSheet.PrintOut
end sub

But why don't you sue the print icon in the toolbar. AFAIK this only
prints the current selected sheet(s)

HTH
Frank

vschlen wrote:
> I am trying to come up with a macro with the ability to print the
> current page.  It has become a big need within my company and will be
> a real time saver.  Is there a way to search for the active cell and
> then print the current page it is in?  In other words, by placing
> your cursor on the page you want to print, you could then run the
> print current page macro.


0
frank.kabel (11126)
2/4/2004 10:13:41 AM
don't forget -- the SHEET  and the CURRENT PAGE are not necessarily the
same.  Some worksheets may print to 20, 30 or more pages.  Defining the
print area is also a useful tool -- but needs to be reset to each different
area as needed.

Kate in MN


"Frank Kabel" <frank.kabel@freenet.de> wrote in message
news:%23k5vRew6DHA.2764@TK2MSFTNGP09.phx.gbl...
> Hi
> SUB print_current()
>     ActiveSheet.PrintOut
> end sub
>
> But why don't you sue the print icon in the toolbar. AFAIK this only
> prints the current selected sheet(s)
>
> HTH
> Frank
>
> vschlen wrote:
> > I am trying to come up with a macro with the ability to print the
> > current page.  It has become a big need within my company and will be
> > a real time saver.  Is there a way to search for the active cell and
> > then print the current page it is in?  In other words, by placing
> > your cursor on the page you want to print, you could then run the
> > print current page macro.
>
>


0
2/4/2004 12:59:03 PM
If I have understood you correctly, this
code will do the job.
Place the cursor in a cell and run the sub,
and the page containing the active cell
will be printed.

Sub PrintPageContainingCursor()
'Leo Heuser, 4 Feb. 2004
Dim Hpb As HPageBreak
Dim HorizPagebreak As Long
Dim NumberOfHorizPages As Long
Dim NumberOfVertiPages As Long
Dim PageNumber As Long
Dim Vpb As VPageBreak
Dim VertiPagebreak As Long

    With ActiveSheet
        NumberOfHorizPages = .HPageBreaks.Count + 1
        NumberOfVertiPages = .VPageBreaks.Count + 1

        For Each Vpb In .VPageBreaks
            If Vpb.Location.Column < ActiveCell.Column Then
                VertiPagebreak = VertiPagebreak + 1
            End If
        Next Vpb

        For Each Hpb In .HPageBreaks
            If Hpb.Location.Row < ActiveCell.Row Then
                HorizPagebreak = HorizPagebreak + 1
            End If
        Next Hpb

        If .PageSetup.Order = xlOverThenDown Then
            PageNumber = NumberOfVertiPages * _
                HorizPagebreak + VertiPagebreak + 1
        Else
            PageNumber = NumberOfHorizPages * _
                VertiPagebreak + HorizPagebreak + 1
        End If

        .PrintOut , from:=PageNumber, to:=PageNumber, copies:=1
    End With
End Sub


-- 
Best Regards
Leo Heuser

Followup to newsgroup only please.

"vschlen" <vschlender@ruekert-mielke-dot-com.no-spam.invalid> skrev i en
meddelelse news:e7qiQfv6DHA.2712@tk2msftngp13.phx.gbl...
> I am trying to come up with a macro with the ability to print the
> current page.  It has become a big need within my company and will be
> a real time saver.  Is there a way to search for the active cell and
> then print the current page it is in?  In other words, by placing
> your cursor on the page you want to print, you could then run the
> print current page macro.
>


0
leo.heuser (111)
2/4/2004 7:22:44 PM
No macro is needed. Just click on the Print button.

-- 
Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"



"vschlen" <vschlender@ruekert-mielke-dot-com.no-spam.invalid> wrote in
message news:e7qiQfv6DHA.2712@tk2msftngp13.phx.gbl...
> I am trying to come up with a macro with the ability to print the
> current page.  It has become a big need within my company and will be
> a real time saver.  Is there a way to search for the active cell and
> then print the current page it is in?  In other words, by placing
> your cursor on the page you want to print, you could then run the
> print current page macro.
>


0
2/4/2004 8:40:20 PM
Reply:

Similar Artilces:

What happened to Pivot Table "Show Pages"?
What happened to the functionality in Pivot Tables to write a new worksheet for each value in a Page Field? I'm sure that it was available in earlier versions of Excel, indeed there are references to "show pages" in other threads in this group, but I can't find it in Excel 2003. Did it go away? -- Jim On the Pivot Table toolbar, choose PivotTable > Show Pages Jim Molter wrote: > What happened to the functionality in Pivot Tables to write a new worksheet > for each value in a Page Field? > I'm sure that it was available in earlier versions of Excel, in...

Text colour printing problem
Hi, We are having problems printing a spreadsheet from a workmate computer. Most of the data is black with the exception of a of a fe rows where the text is red. when the user tries to print the documen comes out in greyscale, I have checked all settings and confiqs an still it prints greyscale, I even opened a new worksheet and typed ou a red test test page, and this prints correctly. I compared th settings of the two sheets; my test one and the orignal sheet and ther was no noticable difference. The machine is running Win 2K Pro wit Excel 2000. I hope someone can please shed some light on t...

Macro to Fomat Excel to .csv File
I have an Excel spreadsheet with contact information I want to import to a CRM lead system. Current Excel sheet format is all in one column going down as follows: Company Name, Address, City State Zip (all one field), Phone number, then empy cell then repeat of 4 cells listed above. Want to convert to a new .csv file with listing going left to right on on line as follows (ending up with 6 column fields - 1. Company Name 2. Address 3. City 4. State 5. Zip 6. Phone Any suggestions on how to accomplish this? Thanks. Kip ...

prints fine on paper, not on card
I am creating wedding response cards, 5.5" X 4.25" (2 down, perforated, on page). They print fine on an 8.5 X 11 piece of paper, but when I use the actual card the bottom .5" is not printed. Can anyone explain that PLEASE?! What version of Publisher? Are you using a postcard setup? Portrait? It could be your printer's limitation. Some ink jets will have a margin limitation of 5.5. If you are using Publisher 2007 I would suggest using the Avery postcard page setup. Tutorial: Finding your Maximum Print Area http://ed.mvps.org/Static.aspx?=Publisher/horidiag -- Mary ...

Mirrored Page Numbers
I want to have mirrored page numbers -- that is page numbers at the left margin on even-numbered pages and page numbers at the right margin on odd-numbered pages. Years ago, I seem to remember doing this quite easily in PageMaker. Now, I'm using Publisher 2007 running under Windows Vista. Can Publlisher do this? If so, how? Thanks in advance for any suggestions. Gordon Yes. 1.Choose View -> Header and Footer 2.(Optional) In the header, type some identifying text at the blinking cursor, such as the word Page 3.Click the Insert Page Number button on the Header and...

Issues Printing Bubble Chart on Canon Printer
We just installed a new Canon printer and when we printed Excel Bubble Charts on the printer, they are rendered as squares, with inscribed circles. The bubbles are formatted to be shaded, so the squares are shaded. Has anyone had this problem and what did you do to fix it? We PDF'd the document and found that the printing problem has disappeared in the PDF'd version. Now we're missing a font on the computer that has the Adobe Acrobat application. If it's not one thing, it's another. I'm still interested in understanding why there's a problem however. "...

slow printing
Just installed new dell for boss with win2k and office 2k, all update including w2k sp4 and off2k sp3. User now states that his HP4000 laser prints slow compared to his win98 that this machine replaced. The slow printing only seem to occur in excell - other programs seem fine. Any suggestions would be much appreciated. Thanks Bob Page ...

spreading a table over two pages
I am using office 2000. I would like to know how to auto flow tables over two pages using microsoft publisher. I have a table on the bottom of one page and it is too large and i want it to automatically spread onto the nest page in my document. Thanks JJ You could make the page longer. -- Don Vancouver, USA "JJ" <JJ@discussions.microsoft.com> wrote in message news:481E0791-B780-4451-A371-8D2C36995343@microsoft.com... >I am using office 2000. I would like to know how to auto flow tables over > two pages using microsoft publisher. I have a table on the bottom...

Printing legal-paper documents
I am unable to print legal-paper sized documents. All other print jobs work fine. Attempted switching the drivers, though printing to any available printer produces the same problem. Other systems aren't running into this problem on the same printers. It isn't an issue with the type of paper feed, in fact, it doesn't seem to even get beyond the program that is trying to send the print job. In addition, there are no errors produced. I'd appreciate any advice, especially if you could email it to me. Thanks, Nathan Sones natesones@yahoo.com ...

Not Print Last Page of a Report
Depending on a value on form, I want to not the last page of a report. Using an event procedure of the report , is there a way to code so the last page does not print? I use the Report Open event to perform several other procedure based on the value of the form. I just can not figure out how to stop the last page from printing. Thanks for any help, Lamar Lamar wrote: >Depending on a value on form, I want to not the last page of a report. >Using an event procedure of the report , is there a way to code so the last >page does not print? I use the Report Open event to perfo...

How to print 11 x 17
I have Publisher 2003 and cannot figure out how to print on 11x17 paper. The document is 11x17. I set the paper size in Publisher and my printer driver (Epson 1280) to print 11x17. I triple verifed my both Publisher and printer driver settings. However, my output is a cropped to 8.5x11 on 11x17 paper. When I return to Publisher after printing, I notice that my page setup has reverted back to 8.5x11 even though the rulers on the document still show 11x17. To make matters even more odd, this document was created in Publisher 2002 and printed just fine. I've enen tried copyin...

MACROS #27
MACROS AND THEIR FUNCTIONS INTENDED code written in visual basic to automate certain repetitive procedures or certain other tasks that cannot be performed through the regula functionality provided by excel/word, or some new customised functio that needs to be created for a specific need, or to simplify cumbersome task that would otherwise take a substantial amount o effort... etc... etc... etc... try to keep your questions outside the realms of juvenility. help is privilege and not a prerogative -- Message posted from http://www.ExcelForum.com ...

Printing problem.
Hi, i'm having a strange problem with some excel files in a Windows 2000 Server (no service pack applied) network. Some users are able to print a file while other are not. No error message is exhibited on screen. Users have the some network rights. This happens only with a few files, all of them located on the same folder on the server. Clients are using Windows 98 SE and Windows Me. We are using Office 2000 SR1 Thanks, -- Carlos Vaz --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.510 / Virus Database: 307 - Release ...

Problem with printing multiple copies of a report
I read and follow the suggestion from this group to wrtie the code for a print sub: DoCmd.RunCommand acCmdSaveRecord DoCmd.SelectObject acReport, "rptCertificate", True DoCmd.PrintOut acPrintAll, , , , InputBox("Enter Number of Copies", _ "Print repCertificate", 1), 0 Access prints one copy even I put 2 in the InputBox or use DoCmd.PrintOut acPrintAll, , , , 2, 0 in stead. Thank you in advance for your help. -- Jeff ...

Can you perform ctrl+shift+; in a macro to display time?
I would like to add current but static time to a cell within a larger macro, but the only way I can find to enter just the time and not date as well is to use ctrl+shift+; but it doesn't appear that macro allow the use of hardkeys, although my knowledge of macros is basic i'm sure there must be a work around. Hi Darran Try: '=============>> Public Sub TesterC() With Range("A1") .Value = Time .NumberFormat = "h:mm AM/PM" End With End Sub '<<============= --- Regards, Norman "Darran Parsons" <Darran...

OWA Logon page #2
I have 2 E2k3 installations and both have https enabled. However, on one installation there is a pretty page that says OWA, public or private check boxes, etc. But on the other when I log onto https://ex.comp.com/exchange it only comes up with a dialog box and not the exchweb page. How can I fix it to have the pretty page? TIA Bobby On Tue, 15 Mar 2005 19:04:35 GMT, "Bobby Janow" <bjanow@msn.com> wrote: >I have 2 E2k3 installations and both have https enabled. However, on one >installation there is a pretty page that says OWA, public or private check >boxe...

Printing document references
Hello, We have a number of forms which we have produced here at work which require numbered references on them so each document is unique. Can this be batch driven ? EG. I have designed a printed sheet in Excel for our stock take this year. We need 200 sheets to be issued out to the guys doing the counting. Each sheet needs its own unique documents reference number on it so it can be traced. How can I automate this so I can print 200 copies of the document, and the document references increase incrementally on each separate page. EG. ABC0001, ABC0002, ABC0003... I dont want to have t...

Global Page Setup for Multiple Sheets
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Is there a way to do a global page setup for an excel project that has multiple spreadsheets vs having to format each and every sheet separately? > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3343386974_22024351 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit On 12/11/09 1:57 PM, in article 59baec68.-1@webcrossing.JaKIaxP2ac0, "JNS999@officeformac.com"...

How to Get OperatingSystem User using Macro
Hi, I would like to display the Operating System User using VB Macro in Excel. I am using Ms Office 2000 Thanks Regards Mili Mili, You can use Application.OperatingSystem to return a string describing the operating system. E.g., Msgbox Application.OperatingSystem -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com chip@cpearson.com "Mili" <mili_rao@yahoo.com> wrote in message news:0b2b01c3a453$7481cb90$a301280a@phx.gbl... > Hi, > I would like to display the Operating System User > using VB Macro in...

Don't want ages Numbers on first few pages
I have a simlar question as the post below. I have a booklet of about 300 pages. The first couple pages I do not need numbered. The actually book starts on page 11 so I want the pages numbers to start counting from there, starting with ‘1’. Can someone advise me of the steps to do this. Thanks!!! http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.publisher&tid=d02e6cd6-7bec-46c8-8e24-42a30fdde351&cat=en-us-office-publisher&lang=en&cr=US&sloc=en-us&m=1&p=1 Bri wrote: > I have a booklet of about 300 pages. The first couple p...

page navigation
my page navigation disappeared from the bottom of my screen. how do i get it displayed again? the only way i can get to different pages now is to use the View and select a page number. Too time consuming. View, Status bar. David Bartosik - [MSFT MVP] http://www.publishermvps.com http://www.davidbartosik.com "lauramar87" <lauramar87@discussions.microsoft.com> wrote in message news:B48F5D53-9AF2-49F4-9AD4-D537B7F08206@microsoft.com... > my page navigation disappeared from the bottom of my screen. how do i get > it > displayed again? the only way i can get to diffe...

IE keep saying "Opening page..." for ActiveX with async property
I tried posting this question to microsoft.public.vc.mfcole, but apparently that is an area only suitable for getting answers to simplistic questions. I've not gotten one response for questions I've posted there. I'm hoping there is some knowledgeable, sharing guru in this area that can help... I have a problem that is related to having an asynchronous property in a an ActiveX control that is used on a web page. If you build the MFC ActiveX Control App Wizard project and put it on a page, no problem--IE will load up and the "Opening page..." message wil...

Page turn effect
Recently created a multi-page piece and would like to present it as I have seen in a number of internet ads. Ad pages have the effect of "turning" at the readers command. How can that effect be brought into publisher creations. Additionally, if available, how can one email a publisher piece so that the end user could appreciate the creation and the page turning effect? Guidance sought. A guess; this sounds like something Power Point would be need for. -- Don - Publisher 2000� Vancouver, USA "Maurice" <Maurice@discussions.microsoft.com> w...

[VOTE]: NEED of a page break function
Hi, I think we NEED a page break function in OneNote. In OneNote 2007, there's an option to select A4 as the page size but I can only have a single sheet of "paper" for every page. This is frustrating as I don't want to create new page every time I run out of inking space. Another reason I want to select A4 size (and have multiple sheets with page breaks) is because it is better for printing (to physical paper or pdf). Right now, having the "infinite page" as default, the page breaks just occur randomly when I print my stuff from OneNote to pdf/physic...

Macro to count inline images
I have to format about 10000 word docs that are generated from another source for a test report. I have built a a macro to do the formating for me but I would rather make it more automated. I have two differnt reports, the only difference between them is the number of inline objects. 1. How do I count the number of inline objects? 2. How do I automate word to run the module on a directory (including sub-directories) 3. How to Save-as in order to maintain the originals? Thank you! Hi Tith, For a given document, you can use a macro like: Sub InlineShapeCount() Dim i As In...