+ Reply to Thread
Results 1 to 3 of 3

Macro to Increment and Print to PDF filename from merged cell

  1. #1
    Registered User
    Join Date
    08-03-2012
    Location
    Tartu, Estonia
    MS-Off Ver
    Excel 2007
    Posts
    9

    Macro to Increment and Print to PDF filename from merged cell

    Hi everybody,

    I'm a total beginner at this. I'm trying to create a macro that would ask a user for a serial number and quantity and based on that print the right amount of documents. There are several but's here though.
    The Workbook this will be used on is protected. The cell where the serial number is entered is a merged cell. Information is stored on 4-5 worksheets, while only sheet 5 needs to be printed. The serial number consists of a mix of letters and numbers (ie. G19273WE0000001)
    This is what I've got so far but it doesn't work for reasons unknown to me.

    Please Login or Register  to view this content.
    I believe I may have defined bvarSplit wrong as a variant but for the life of me I can't figure out how else to define it so that it could be incremented and retain the 0-s in front.
    I've tried removing the time delay and else clause about the number of digits, but to no avail.
    Using WinXP and Excel 2007. I could really use some help on this.

    I could get the following script running, but it doesn't consider the entered serial number when printing the first page.

    Please Login or Register  to view this content.
    So what I'm essntially struggling with is this:
    1) The script seems to ignore anything printing related
    2) How do I retain zeros in the last 4 digits of the serial number while incrementing it
    Last edited by ahjualune; 08-08-2012 at 02:01 AM. Reason: Additional information

  2. #2
    Registered User
    Join Date
    08-03-2012
    Location
    Tartu, Estonia
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Macro to Increment and Print to PDF filename from merged cell

    I've taken a slightly different approach and using PDFCreator instead. This is even better in my case seeing that other people that will be using this macro already have PDFCreator installed. This is what I've got so far. Credits are due to:
    http://www.excelguru.ca/content.php?161 and numerous other selfless VBA guides found on the web.

    Please Login or Register  to view this content.
    The problem I'm still struggling with is properly incrementing the serial number without losing the 0-s. Obviously the line
    Please Login or Register  to view this content.
    does not work at all. How can I mend this?

  3. #3
    Registered User
    Join Date
    08-03-2012
    Location
    Tartu, Estonia
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Macro to Increment and Print to PDF filename from merged cell

    For anyone out there in the future with a similar problem, I've solved it and here's how:
    Enabling PDFCreator module in References is required. The code is as follows:

    Please Login or Register  to view this content.

+ 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