ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   moving folders (https://www.excelbanter.com/excel-programming/285565-moving-folders.html)

Gary[_11_]

moving folders
 
I am trying to move a folder from "quotes" to "sales" and
cannot get it right. What is wrong?
Sub Move()
Dim sFolder As Scripting.folder
Dim sDestination As String
Set sFolder = "\\quotes\" & ActiveSheet.Range("S7")
& "\" & ActiveSheet.Range("h14")
sDestination = "\\Sales\" & ActiveSheet.Range("S7")
& "\" & ActiveSheet.Range("h14")
MoveFolder sFolder, sDestination
End Sub

Don Guillett[_4_]

moving folders
 
If you mean move a file from one folder to another you can modify this.

Sub movefile()
OldName = "C:\sourcefoldername\1065.xls"
NewName = "C:\destinationfoldername\1065.xls"
Name OldName As NewName
End Sub


--
Don Guillett
SalesAid Software

"Gary" wrote in message
...
I am trying to move a folder from "quotes" to "sales" and
cannot get it right. What is wrong?
Sub Move()
Dim sFolder As Scripting.folder
Dim sDestination As String
Set sFolder = "\\quotes\" & ActiveSheet.Range("S7")
& "\" & ActiveSheet.Range("h14")
sDestination = "\\Sales\" & ActiveSheet.Range("S7")
& "\" & ActiveSheet.Range("h14")
MoveFolder sFolder, sDestination
End Sub




Tom Ogilvy

moving folders
 
This worked for me:

Sub MoveAFolder(Drivespec)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.MoveFolder Drivespec, "\\logfs03\Users\Ogilvtw\TT2\"
End Sub

Sub CallMove()
Drivespec = "\\logfs04\Dpl-div\TT1"
MoveAFolder Drivespec
End Sub

--
Regards,
Tom Ogilvy


"Gary" wrote in message
...
I am trying to move a folder from "quotes" to "sales" and
cannot get it right. What is wrong?
Sub Move()
Dim sFolder As Scripting.folder
Dim sDestination As String
Set sFolder = "\\quotes\" & ActiveSheet.Range("S7")
& "\" & ActiveSheet.Range("h14")
sDestination = "\\Sales\" & ActiveSheet.Range("S7")
& "\" & ActiveSheet.Range("h14")
MoveFolder sFolder, sDestination
End Sub




Gary[_11_]

moving folders
 
When I tried it, it brought up a list of macros to select
and run. Any idea why or how to fix?
-----Original Message-----
This worked for me:

Sub MoveAFolder(Drivespec)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.MoveFolder Drivespec, "\\logfs03\Users\Ogilvtw\TT2

\"
End Sub

Sub CallMove()
Drivespec = "\\logfs04\Dpl-div\TT1"
MoveAFolder Drivespec
End Sub

--
Regards,
Tom Ogilvy


"Gary" wrote in

message
...
I am trying to move a folder from "quotes" to "sales"

and
cannot get it right. What is wrong?
Sub Move()
Dim sFolder As Scripting.folder
Dim sDestination As String
Set sFolder = "\\quotes\" & ActiveSheet.Range("S7")
& "\" & ActiveSheet.Range("h14")
sDestination = "\\Sales\" & ActiveSheet.Range("S7")
& "\" & ActiveSheet.Range("h14")
MoveFolder sFolder, sDestination
End Sub



.


Tom Ogilvy

moving folders
 
You have to run CallMove, not MoveAfolder.

However, I offered it as a sample of how you might fix your own macro.

--
Regards,
Tom Ogilvy

"Gary" wrote in message
...
When I tried it, it brought up a list of macros to select
and run. Any idea why or how to fix?
-----Original Message-----
This worked for me:

Sub MoveAFolder(Drivespec)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.MoveFolder Drivespec, "\\logfs03\Users\Ogilvtw\TT2

\"
End Sub

Sub CallMove()
Drivespec = "\\logfs04\Dpl-div\TT1"
MoveAFolder Drivespec
End Sub

--
Regards,
Tom Ogilvy


"Gary" wrote in

message
...
I am trying to move a folder from "quotes" to "sales"

and
cannot get it right. What is wrong?
Sub Move()
Dim sFolder As Scripting.folder
Dim sDestination As String
Set sFolder = "\\quotes\" & ActiveSheet.Range("S7")
& "\" & ActiveSheet.Range("h14")
sDestination = "\\Sales\" & ActiveSheet.Range("S7")
& "\" & ActiveSheet.Range("h14")
MoveFolder sFolder, sDestination
End Sub



.





All times are GMT +1. The time now is 09:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com