Using an Excel Macro to move a folder with XP

P

Peter

Hi, I've posted this question 2 or 3 times, but I haven't gotten any responses. Can someone please give me a little help

The following macro takes files that are in one directory ("C:\Fishbowl\Req_Serv\one"), and puts them in a newly created directory ("C:\Fishbowl\Solved_Service_Cases\one". This works in Excel 2000 running on 98, but does not work in Excel 2000 running on XP

In 98, this creates a new subdir named "one" under "Solved_Service_Cases" and MOVES everything from the first directory into it

(Before running this macro, there is a dir called "one" in the "oldname" directory but not in the NewName directory.
I have heard that XP will not create a new diredtory this way

Can anyone tell me how I can make a new subdirectory, and MOVE (not just save as) the contents of another directory into it using XP


Thank you very muc

Sub xp98(

Dim OldName As Strin
Dim NewName As Strin
Dim myfolder As Strin

With ThisWorkboo
myfolder = ("one"

OldName = "C:\Fishbowl\Req_Serv\" & myfolde
NewName = "C:\Fishbowl\Solved_Service_Cases\" & myfolde
Name OldName As NewNam

End Wit

End Su
 
B

Bob Phillips

Peter,
You are tryin g to create and rename in one step. Try this

Sub xp98()
Dim OldName As String
Dim NewName As String
Dim myfolder As String

With ThisWorkbook
myfolder = "myTest3"

OldName = "C:\myTest\" & myfolder
MkDir "C:\Fishbowl\Solved_Service_Cases"
OldName = "C:\Fishbowl\Req_Serv\" & myfolder
NewName = "C:\Fishbowl\Solved_Service_Cases\" & myfolder
Name OldName As NewName

End With

End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Peter said:
Hi, I've posted this question 2 or 3 times, but I haven't gotten any
responses. Can someone please give me a little help.
The following macro takes files that are in one directory
("C:\Fishbowl\Req_Serv\one"), and puts them in a newly created directory
("C:\Fishbowl\Solved_Service_Cases\one". This works in Excel 2000 running
on 98, but does not work in Excel 2000 running on XP.
In 98, this creates a new subdir named "one" under "Solved_Service_Cases"
and MOVES everything from the first directory into it.
(Before running this macro, there is a dir called "one" in the "oldname"
directory but not in the NewName directory.)
I have heard that XP will not create a new diredtory this way.

Can anyone tell me how I can make a new subdirectory, and MOVE (not just
save as) the contents of another directory into it using XP?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top