+ Reply to Thread
Results 1 to 3 of 3

Excel 2007 - Print Macro - Infinite Loop Issue

  1. #1
    Registered User
    Join Date
    03-30-2012
    Location
    Germany
    MS-Off Ver
    Excel 2003/2010
    Posts
    9

    Excel 2007 - Print Macro - Infinite Loop Issue

    Hello everybody!

    As described in the title, my issue is a print macro that loops infinitely in Excel 2007 (weirdly not in '03 or '10)

    File: The excel file I'm working on has one sheet with the list of contents and 200 sheets with data.
    I use Excel 2003 to work on it, but the final file needs to work on 2007 as well.

    Task: Checkboxes for each item in the list of contents to select any amount of data sheets to be printed.

    Solution: When a checkbox is checked, it adds the value "PRINT" to a specific cell (G1), or deletes the value when unchecked.
    A Button called Print then prints each sheet with the Value "PRINT" in cell G1

    Please Login or Register  to view this content.
    Problem: This works like a charm in Excel 2003 and 2010. In 2007 whatsoever the macro loops infinitely and reprints the selected pages.
    (If you want to test this I sugest using the Microsoft XPS Printer, since it stopps everything when you press cancel)

    I think the correct path of solving this would be by limiting the loops to the amount of selected pages(LBound/UBound?), but I have no Idea how to include this.
    I can count the amount of selected pages with this macro:

    Please Login or Register  to view this content.
    Thanks already for any help and suggestions!

  2. #2
    Registered User
    Join Date
    03-30-2012
    Location
    Germany
    MS-Off Ver
    Excel 2003/2010
    Posts
    9

    Lightbulb Re: Excel 2007 - Print Macro - Infinite Loop Issue

    I might have found a solution, but have yet to try it, since I'm lingering outside in the sun.

    Just gonna count the times a print happens and stop as soon as the count equals my PRINT value count c.
    Still figuring out where to put it exactly, but maybe sth. among these lines:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-30-2012
    Location
    Germany
    MS-Off Ver
    Excel 2003/2010
    Posts
    9

    Angry Re: Excel 2007 - Print Macro - Infinite Loop Issue

    My previous idea was no good.

    By using Print.Debug in various places of the code I discovered that Excel'07 always runs into an Error after the first printjob and than starts all over again.
    If multiple sheets are selected, it still just reprints the first one that is selected over and over again.

    Anybody have any idea why that is happening in '07 but not the others?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1