moving folders

  • Thread starter Thread starter Gary
  • Start date Start date
G

Gary

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
 
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
 
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
 
When I tried it, it brought up a list of macros to select
and run. Any idea why or how to fix?
 
You have to run CallMove, not MoveAfolder.

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