?
Solved

Rename and Delete sub folders

Posted on 2014-01-01
4
Medium Priority
?
342 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 1000 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 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

765 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