All,
I am trying to automate a renaming of files that get scanned to a specific folder.
The code that works with no errors is
The problem is I need the file to get renamed into a folder called "PDF" where "ThisWorkbook" resides.![]()
Sub FileRENAME() Dim Target_Folder As String Dim iName As String Target_Folder = ThisWorkbook.Path & "\" iName = Sheets("RENAME PROGRAM").Range("C1").Text Name Target_Folder & "Scan.pdf" As Targe_Folder & iName & ".pdf" End Sub
The code I WANT to use so when the file name gets renamed, it STAYS in the folder "PDF" but if I add a "PDF" subfolder it gives a Debug error.
I know I'm probably missing a step or have not formatting it just right. If push comes to shove I can always keep it in my "Documents" folder but am trying to automate this so it is easy for folks to find the file quickly rather than combing through hundreds of files in "Documents".![]()
Sub FileRENAME() Dim Target_Folder As String Dim iName As String Target_Folder = ThisWorkbook.Path & "\PDF\" iName = Sheets("RENAME PROGRAM").Range("C1").Text Name Target_Folder & "Scan.pdf" As Targe_Folder & iName & ".pdf" End Sub
TL;DR;
ThisWorkbook is in a subfolder called "PDF"
I run macro and the file gets moved out of PDF into a folder called Documents.
I tried added a "PDF" sub folder in the code and throws an error.
Bookmarks