Solved

Rename and Delete sub folders

Posted on 2014-01-01
4
341 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 85

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 58

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

705 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