Results 1 to 8 of 8

Thread: Help with renaming part of file

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Help with renaming part of file

    All,

    Good afternoon. I have hundreds of pdf files with "Model (1)" as part of filename that I would like stripped off, i.e. Y-45E-0372 Model (1).pdf I have tried following code but to no avail (Error: Expected end of statement). Would someone be so kind to take a look at code and see what is wrong? I sure would appreciate it.

    Dim strFolder As String
    Dim strFile As String
    strFolder = "C:\Dave"
      strFile = Dir(strFolder & "\*.*")
      Do While Len(strFile) > 0
        If InStr(strFile, "Model (1)") > 0 Then
            Name strFolder & strFile As strFolder & Replace(strFile, "Model (1), "")
        End If
        strFile = Dir()
      Loop
    Thank you,
    David
    Last edited by Aussiebear; 02-15-2025 at 03:44 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •