Locating a file and renaming it based on existing excel sheet data

subbby

New Member
Joined
Aug 29, 2012
Messages
9
What I have :
  • Have a file name subbby.pdf in a folder
  • Have an excel sheet (screenshot attached)

What I need :
  • Having given the directory where this file is located, I want the VBA program to select that file;
  • Then ask the user for a file number (see attached screenshot) : I presume this can be done by an input MsgBox
  • Then rename this file as “Sr. Number_subbby_filenumber.pdf”
  • Also populate the excel sheet with the new name

If gone by the attached screenshot, it shall be : 4_subbby_173B16.pdf ; where 173B16 shall be the file number


Attachments
  1. Screenshot of the table
  2. Excel sheet with the table

My Attempts:
For renaming the file, I tried using
Code:
[COLOR=#333333]NAME "old file name" as "new file name"[/COLOR]
.

But here, the new file name is to be generated by two inputs, namely, the user input (file number) & sr.number(from the existing excel sheet) :oops:


Pls Help. Thanks in advance
ICO



P.S: HOW TO UPLOAD/ATTACH FILES??? CANT SEE ANY



 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
I am unable to upload files so as to help you understand my query. However pls see the table below,


  • Range A1:A15 are all serial number
  • Column B has file name
  • Column C has File number (to be given as input by user)
  • Column D has the NEWLY GENERATED file name


P.S. All files are in different filepath :ROFLMAO:
Sr. NumbersFile NameFile NumberDesired name
1

<tbody>
</tbody>
Instruction Manual1A11_Instruction Manual_1A1
2Service Manual144382_Service Manual_14438
3Parts List221553_Parts List_22155
4Technical SpecificationA217274_Technical Specification_A21727

<tbody>
</tbody>
 
Upvote 0
@RoryA

M just looking for answers... Is it against board rules to post the same query in different forums?
 
Upvote 0
No, but it is common courtesy to provide links to your cross posts (as it says in our rules). Other sites may enforce this more stringently.
 
Upvote 0
Sorry about it. Shall adhere to the rules. Just reading them one by one.

Thanks & Sorry again !
 
Upvote 0
To what cell does sr.number refer?
Hello,

was hoping I could get some help from you.


  • Range A1:A15 are all serial number
  • Column B has file name
  • Column C has File number (to be given as input by user)
  • Column D has the NEWLY GENERATED file name
 
Upvote 0

Forum statistics

Threads
1,215,261
Messages
6,123,939
Members
449,134
Latest member
NickWBA

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top