Solved

Rename folder with VBA

Posted on 2011-02-14
3
520 Views
Last Modified: 2012-06-27
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
Comment
Question by:davidam
  • 2
3 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 250 total points
ID: 34889650
Are you sure the path is correct - e.g. it's definitely "NewFolder" and not "New Folder" with a space?
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 34889661
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
 

Author Closing Comment

by:davidam
ID: 34889734
Yes, it was just sloppiness on my part.  The code works fine if it is done properly.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now