[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 536
  • Last Modified:

Rename folder with VBA

I have a folder as follows C:\NewFolder  This is found in Cell A2.
Cell A5 has the path to this folder C:\
I am trying to rename folder 'NewFolder' to 'FolderX'
My code is attached.   I get a File not Found error.
Please tell me what I am doing wrong.  Thanks!

Name (Range("A2").Value As Range("A5").Value & "FolderX"

Open in new window

0
davidam
Asked:
davidam
  • 2
1 Solution
 
Rory ArchibaldCommented:
Are you sure the path is correct - e.g. it's definitely "NewFolder" and not "New Folder" with a space?
0
 
Rory ArchibaldCommented:
PS I'm assuming that parenthesis between Name and Range is a typo and isn't actually in your code, since it wouldn't compile otherwise.
0
 
davidamAuthor Commented:
Yes, it was just sloppiness on my part.  The code works fine if it is done properly.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now