Solved

Rename and Delete sub folders

Posted on 2014-01-01
4
338 Views
Last Modified: 2014-01-02
Hi

I have folders on dropbox. as follows
C:\Users\Public\Dropbox\Client\DirectSales\EnvirpPacific.

My question is how can I using vba change the name or delete the folder EnviroPacific

I can change a root folder name
Dim strOldDirName As String
Dim strNewDirName As String
 
strOldDirName = "C:\Zmyfolder"

strNewDirName = "C:\Pfolder"
Name strOldDirName As strNewDirName

I get errors when I add Sub folders.

Any help would be appreciated

chestera
0
Comment
Question by:chestera
  • 2
4 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 250 total points
ID: 39750977
I get errors when I add Sub folders.
What do you mean by that? Do you mean you get an error when you try this:

Name "C:\Folder1\Folder2" As "C:\Folder1\FolderB"

If so, what is the error?
0
 
LVL 57

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 250 total points
ID: 39750981
Chestra,

 I had no problem doing:

Name "C:\TEMP\TEST1" as "C:\TEMP\TEST2"

 'TEST1' being a sub-folder.   Note that you can't rename a folder that's open.

What's the error your getting?  

Jim.
0
 

Author Comment

by:chestera
ID: 39751023
Jim Dettman

My apologies. With my example I got and error on the last line Name path not found although the path was or looked correct so I rewrote as follows

Dim strOldDirName As String
Dim strNewDirName As String

strOldDirName = "C:\FolderA\FolderB"

strNewDirName = "C:\FolderA\FolderC\"
Name strOldDirName As strNewDirName

This time no problems. Must have been a glitch in my first attempt

I will split the points

Alan
0
 

Author Comment

by:chestera
ID: 39751027
many thanks feeling a bit foolish
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

809 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