Solved

Changing part of a macros function (Selecting a pdf file from numerous pdf files in a directory)

Posted on 2013-12-01
2
178 Views
Last Modified: 2013-12-01
Below is macro code currently in use:
Sub DuplicateRename()
    strFileCopyFrom = ThisWorkbook.Path & "\" & "Template Checklist.pdf"
    For Each c In Range(Range("A2"), Range("A" & Cells.Rows.Count).End(xlUp))
        strFileCopyTo = ThisWorkbook.Path & "\" & "Template Checklist" & "_" & Format(c, "000") & ".pdf"
        FileCopy strFileCopyFrom, strFileCopyTo
    Next
End Sub

The "Template Checklist.pdf" is fine in there is only one document with that name in the folder.

The folder will soon contain numerous PDF files. Is there an easy way to select the needed file and still fulfill the rest of the macro's function?

Thanks for any suggestions.
0
Comment
Question by:dgd1212
2 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
ID: 39688968
This will ask for a number and will do it to the file with that number
Sub DuplicateRenamebynum()
    strFileCopyFrom = ThisWorkbook.Path & "\" & "Template Checklist.pdf"
    c = InputBox("File Number")
        strFileCopyTo = ThisWorkbook.Path & "\" & "Template Checklist" & "_" & Format(c, "000") & ".pdf"
        FileCopy strFileCopyFrom, strFileCopyTo
End Sub

Open in new window

0
 

Author Closing Comment

by:dgd1212
ID: 39689004
Thank you!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question