+ Reply to Thread
Results 1 to 7 of 7

Run-time error 1004 - save as pdf problem

  1. #1
    Registered User
    Join Date
    04-27-2012
    Location
    SG
    MS-Off Ver
    Excel 2010
    Posts
    9

    Question Run-time error 1004 - save as pdf problem

    Hi guys,

    I have a problem when I run this script. don't know what the problem. Debugger gives me Run-time error 1004 and when I stop debugger excel crashes.

    Please Login or Register  to view this content.
    Highlighted code is
    Please Login or Register  to view this content.
    Can you help, please? truly don't know what the problem tnx

  2. #2
    Valued Forum Contributor
    Join Date
    11-02-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    564

    Re: Run-time error 1004 - save as pdf problem

    Will you be able to upload your file as sample?

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Run-time error 1004 - save as pdf problem

    When the crash occurs and you DEBUG, hover your mouse over pdfName.... what is the exact current value of that variable?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    04-27-2012
    Location
    SG
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Run-time error 1004 - save as pdf problem

    Invoice Blank.xlsm

    Hi haripopuri,

    here is the file.

    tnx for help

  5. #5
    Registered User
    Join Date
    04-27-2012
    Location
    SG
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Run-time error 1004 - save as pdf problem

    Value is root\PDF Archive\100 Invoice Name.pdf

    It manages to save pdf version of the file but then show popup with Run-time error with debug and end options. When I chose debug code is highlighted if I chose end, Excel crashes.

    Tnx

  6. #6
    Valued Forum Contributor
    Join Date
    11-02-2012
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    564

    Re: Run-time error 1004 - save as pdf problem

    Hi vvujke,

    In the pdfname variable value, "PDF Archive" folder is already existing in your system? What I see is when excel tries to save in the exact path given in pdfname, if it could not find the PDF Archive folder, its causing a run time error. You will have to first create the folder and then try to save the file.

  7. #7
    Registered User
    Join Date
    04-27-2012
    Location
    SG
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Run-time error 1004 - save as pdf problem

    Hi haripopuri,

    I have PDF Archive folder created. It creates pdf in that folder and after that it crashes. In VBA line OpenAfterPublish:=False is marked with the arrow...

    tnx

+ Reply to 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