Results 1 to 3 of 3

Excel Macro to PDF 400 error

Threaded View

  1. #1
    Registered User
    Join Date
    09-25-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    4

    Excel Macro to PDF 400 error

    Hi I am working on a Macro to make PDF files using formula on other tabs.
    My Macro creates the first PDF and then stops with Error 400 or Error 1004.
    Can you please help to get this to work.
    Here is my Macro:

    Sub CreateFiles()
    'Make Excel and PDF directories to store each version
    Dim BatchFolder As String
    Dim rng As Range, cell As Range

    BatchFolder = "\batch " & Format$(Now, "DD-MM-YYYY h.mm.ss AM/PM")

    MkDir FolderName + BatchFolder
    MkDir FolderName + BatchFolder + "\PDF"


    PdfFolderName = FolderName + BatchFolder + "\PDF"


    Set rng = Evaluate(Sheets("CEO Dashboard").Range("AH7").Validation.Formula1)

    For Each cell In rng

    Sheets("CEO Dashboard").Range("AH7").Value = cell.Value

    'Save As PDF
    'ThisWorkbook.Sheets("CEO Dashboard").Select

    Application.DisplayAlerts = False

    Sheets("CEO Dashboard").ExportAsFixedFormat Type:=xlTypePDF, Filename:=PdfFolderName + "\" + CStr(Sheets("CEO Dashboard").Range("AH11").Value) + " - " + Sheets("CEO Dashboard").Range("AH11").Value + " - CEO Dashboard.pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False

    Application.DisplayAlerts = True

    Next

    End Sub
    Last edited by Edvinx2000; 09-26-2014 at 11:26 AM. Reason: Resolved

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. MACRO ERROR WITH EXCEL 2013 - Run-Time Error '-2147417848 (80010108)'
    By graiggoriz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-29-2014, 11:07 AM
  2. Excel macro (compile error. syntax error.) error
    By salar_younis in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-06-2014, 06:11 AM
  3. Replies: 2
    Last Post: 11-26-2012, 08:33 AM
  4. Excel Macro Error - Run time error 1004 - Paste method of worksheet class failed
    By kvflynn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2012, 10:51 AM
  5. Excel 2003 Macro Error - Runtime error 1004
    By Cow in forum Excel General
    Replies: 2
    Last Post: 06-07-2005, 09:05 AM

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