+ Reply to Thread
Results 1 to 3 of 3

How do I export files to pdf by naming them with values in two cells

  1. #1
    Registered User
    Join Date
    05-15-2018
    Location
    Houston, TX
    MS-Off Ver
    Office 2013
    Posts
    3

    How do I export files to pdf by naming them with values in two cells

    Thanks in advance for any possible help. I can't figure out the vba code to make this work.

    Here is a summary of what I am trying to do:

    Cells a1 to a 50 have location numbers.

    I need to copy cell a1 to cell c1. When that occurs cell d1 displays a name. Then I need to export the file to pdf with the name C:\test\d1\c1.

    Then I need to repeat for cells a2 through a50.

    The other catch is that sometimes the A column might have more or less than 50.

    I can get the the exporting part and copying part correct but I am having problems trying to loop this for all 50 or so and save using the name format.

    Again, thanks for any and all help - Folks on this forum have been extremely helpful.
    Sid

  2. #2
    Valued Forum Contributor dotchiejack's Avatar
    Join Date
    05-21-2015
    Location
    Antwerp,Belgium
    MS-Off Ver
    2016
    Posts
    507

    Re: How do I export files to pdf by naming them with values in two cells

    Not sure what you mean.
    Maybe this?
    Please Login or Register  to view this content.
    Make sure you have a folder on the C disk with the name test.

  3. #3
    Registered User
    Join Date
    05-15-2018
    Location
    Houston, TX
    MS-Off Ver
    Office 2013
    Posts
    3

    Re: How do I export files to pdf by naming them with values in two cells

    here is my slightly changed version of this. I need the file to be called C:\test\Name in c2\Number in c1.pdf. I am getting an 1004 error when trying to save.
    Thanks,
    Sid


    Sub Macro1()
    Dim i As Long
    With ActiveSheet
    For i = .Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
    Range("c1").Select
    ActiveCell.FormulaR1C1 = Range("A" & i)
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\test\" & .Range("c2") & "\" & .Range("c1") & ".Pdf", _
    Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
    Next
    End With
    End Sub

+ 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. [SOLVED] Export Data in Rows, Separated by Empty Cells to Text Files
    By leoxanigm in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-16-2014, 09:53 AM
  2. [SOLVED] Export CSV file in Specific naming format
    By momer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-27-2013, 06:08 PM
  3. Export Unique Values from two excel files into a third file
    By pwilkes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-12-2013, 06:14 PM
  4. export specific cells to several text files
    By BSJ in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-01-2013, 04:20 AM
  5. Export sheets copy/paste Values And Formats with merge cells
    By creusemeninge in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-30-2013, 09:55 AM
  6. [SOLVED] Naming worksheets with values from cells
    By OlYeller21 in forum Excel General
    Replies: 2
    Last Post: 06-21-2012, 09:22 AM
  7. Customized macro to export cells to txt files?
    By Handyy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-23-2010, 09:27 AM
  8. Re-naming many excel files in a folder by VBA
    By ali84pk in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 12-13-2009, 04:05 PM

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