+ Reply to Thread
Results 1 to 2 of 2

Save multiple pdf files using contents of a string

  1. #1
    Registered User
    Join Date
    01-05-2016
    Location
    Houston, TX
    MS-Off Ver
    2010
    Posts
    4

    Save multiple pdf files using contents of a string

    I have a document built out in excel that has up to 6 versions and I would like to save from 1 up to 6 at a time as a PDF using vba. I am having trouble setting up the file name. Below is the code I have written:

    Versions is how many versions of the file to make, VersionNames is a string that contains the 6 names of the different versions of the document I would like to save.

    For d = 1 To Versions
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    DesktopAddress & "\" & VersionNames(d) & " Type of File.pdf", Quality:= _
    xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
    OpenAfterPublish:=True
    Next d

    When I attempt to run the program, I get the following error:

    "Run-time error '-21470 18887 (80071779)':

    Document not saved.

    Hitting debug highlights the above code in yellow. If I make VersionNames just one value it works perfectly, but it won't let me use specific parts of the array. Any suggestions for getting it to work?

  2. #2
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Save multiple pdf files using contents of a string

    Dear peter1992:

    Have you checked the value of the variable "VERSIONS"?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 09-09-2014, 05:21 PM
  2. [SOLVED] Import file contents (xml) from multiple zip files
    By JP Romano in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-21-2014, 06:33 AM
  3. Macro to open multiple files, remove header and save multiple files in a new format
    By twocircles in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-17-2014, 05:24 PM
  4. Excel Macro to save several text files, based on the contents of two cells.
    By chronologie2 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-29-2012, 11:31 AM
  5. Merge contents of multiple files into one
    By rakiii in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-25-2011, 04:29 PM
  6. Save multiple files using contents of a column
    By Bien1986 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-16-2011, 11:53 PM
  7. How to save contents of a cell into a string
    By help000 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-19-2007, 10:46 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