Closed Thread
Results 1 to 2 of 2

Macro - Feeding path and file name to PDF maker

Hybrid View

  1. #1
    Bill
    Guest

    Macro - Feeding path and file name to PDF maker

    Hi,

    I am using a macro to create a report and the last step is to print a
    particular worksheet using a PDF maker. I have figured out how to specify
    the printer as being the PDF maker, but I also want to be able to
    automatically enter the file name and path, which I will build within the
    macro depending upon some user inputs. I've built the text strings as I
    need, I just need to be able to "feed" them to the PDF maker rather than
    have the dialog box come up and ask the user for that information.

    Any help?

    Bill



  2. #2
    Darcy
    Guest

    RE: Macro - Feeding path and file name to PDF maker

    Hi Bill,

    I stumbled in here today to find the answer to a similar question. I also am
    creating a macro to automatically print Excel worksheets to pdf. The
    following is what I have so far in part of my macro:

    Application.ActivePrinter = "Adobe PDF on Ne00:"
    If XStr = "X" Then
    Application.Run AppStr
    Sheets("SUMMARY").Select
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True,
    PrToFileName:="C:\Documents and Settings\marusichd\Desktop\Email Worksheets\"
    & CoName & ".pdf"
    Sheets("FLEET").Select
    ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True,
    PrToFileName:="C:\Documents and Settings\marusichd\Desktop\Email Worksheets\"
    & CoName & "2.pdf"
    Sheets("SELECT TO PRINT").Select

    End If

    It seems to work ok up to a point. The pdf file is created in the selected
    location, however the file is empty (0 KB) or when opened states it is
    corrupt. !?! This is what I was looking for help on. Did you get anything to
    work out?

    Thanx,
    Darcy :o)


    "Bill" wrote:

    > Hi,
    >
    > I am using a macro to create a report and the last step is to print a
    > particular worksheet using a PDF maker. I have figured out how to specify
    > the printer as being the PDF maker, but I also want to be able to
    > automatically enter the file name and path, which I will build within the
    > macro depending upon some user inputs. I've built the text strings as I
    > need, I just need to be able to "feed" them to the PDF maker rather than
    > have the dialog box come up and ask the user for that information.
    >
    > Any help?
    >
    > Bill
    >
    >
    >


Closed Thread

Thread Information

Users Browsing this Thread

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

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