Solved

Rename and Delete sub folders

Posted on 2014-01-01
4
330 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

760 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

16 Experts available now in Live!

Get 1:1 Help Now