Results 1 to 11 of 11

Renaming File from "Scan.pdf" to Target Cell Text, Debug Error.

Threaded View

  1. #1
    Forum Contributor
    Join Date
    05-03-2021
    Location
    Nashville
    MS-Off Ver
    MS Office 365
    Posts
    189

    Renaming File from "Scan.pdf" to Target Cell Text, Debug Error.

    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
    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 problem is I need the file to get renamed into a folder called "PDF" where "ThisWorkbook" resides.

    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.

    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
    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".

    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.
    Attached Files Attached Files
    Last edited by thenewkidd; 02-13-2023 at 10:33 PM. Reason: Work around.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Why I get "Object required" debug error (Beginner level)
    By rcurious in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-14-2021, 02:23 AM
  2. Replies: 11
    Last Post: 08-05-2020, 10:10 AM
  3. [SOLVED] Help to Debug error "Can't perform requested operation"
    By Andrew Entee in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-03-2019, 09:43 AM
  4. Replies: 4
    Last Post: 03-11-2016, 03:34 PM
  5. "Worksheet change" not changing cell on other sheet to match target cell "fill".
    By Ochimus in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-02-2015, 12:02 PM
  6. Excel 2010 (Run-time error '13' type mismatch) "Debug" and "Continue" Grayed out.
    By Jeronimo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-18-2012, 06:42 PM
  7. Transfert cell values from file "A" to file "B" skipping columns in file "B".
    By Sentrosi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-16-2009, 11:11 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