Consulting

Results 1 to 3 of 3

Thread: Help with renaming files (Name "xxxxxxx" As "yyyyyyyy" wont work)

  1. #1
    VBAX Regular
    Joined
    May 2018
    Posts
    14
    Location

    Help with renaming files (Name "xxxxxxx" As "yyyyyyyy" wont work)

    So as the title suggest I need help with renaming files. The Name As function I cant seem to get working for some reason


    The macro will need to loop through two columns with old and new names, preferably I would like to have the old files deleted too.

    I get the message box that all files have ben renamed succesfully.


    This does nothing.
    Sub RenameFiles()
    
    Dim oldNa As String
    Dim newNa As String
    
    
    oldNa = Range("FO10")
    newNa = Range("FP10")
    Name oldNa As newNa
    
    
    End Sub

    So does this


    Sub RenameFiles()
    
    Name "C:\Users\xxxxxxx.AD\Desktop\Test\Vattenfall Invoice.txt" As "C:\Users\xxxxxx.AD\Desktop\Test\Vattenfall fakturorYYMM.txt"
    
    
    End Sub

  2. #2
    VBAX Expert
    Joined
    Aug 2004
    Posts
    810
    Location
    Well, your second example works for me. The only thing is that your "x" don't match.

  3. #3
    VBAX Regular
    Joined
    May 2018
    Posts
    14
    Location
    Thanks for the confirmation, I found the problem, I hadnt selected the right macro for the button I was using. Stupid

Tags for this Thread

Posting Permissions

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