M
Mark
Please can someone assist with this problem?
I am using the following code with I got from the newsgroups which moves
files from one location to another.
Sub MoveForPrint()
Dim i As Integer
Dim Response As Integer, TotalFiles As Integer
Dim counter As Integer
On Error Resume Next
'This part of the routine copies all files and subfolders from sFolder to
sPrintFolder.
'Note: If sPrintFolder already exist it will overwrite existing files in
this folder
'if sPrintFolder not exist it will be made for you.
'test locations
'sFolder = "C:\Orig" '<< Change
'sPrintFolder = "C:\Destination\ToPrint" '<< Change
'U Drive test
'sFolder = "U:\WT Business Services\Print Unit\Victim Letters"
'<< Change
'sPrintFolder = "U:\WT Business Services\Print Unit\Victim
Letters\ToPrint" '<< Change
sFolder = "U:\EA Kirklees\Management Support\Victims\Victim Letters"
'<< Change
sPrintFolder = "U:\EA Kirklees\Management Support\Victims\Victim
Letters\ToPrint" '<< Change
'If you want to create a backup of your folder every time you run this
macro
'you can create a unique folder with a Date/Time stamp.
'sPrintFolder = "C:\" & Format(Now, "dd-mmm-yy h-mm-ss")
If Right(sFolder, 1) = "\" Then
sFolder = Left(sFolder, Len(sFolder) - 1)
End If
If Right(sPrintFolder, 1) = "\" Then
sPrintFolder = Left(sPrintFolder, Len(sPrintFolder) - 1)
End If
Set FSO = CreateObject("scripting.filesystemobject")
If FSO.FolderExists(sFolder) = False Then
MsgBox sFolder & " doesn't exist"
Exit Sub
End If
FSO.CopyFolder Source:=sFolder, Destination:=sPrintFolder
'MsgBox "You can find the files and subfolders from " & sFolder & " in "
& sPrintFolder
MsgBox ("The documents have been moved for printing."), vbInformation, ""
End Sub
The code works fine on the 'C:\Drive but when I run it on the network drives
it seems to work, but it removes the files form the original location and
looses all the files!
I have checked the filepaths and they seem to be correct!
Can someone assist me with a solution whether it be a alteration to this
code or an alternative, please?
I am using the following code with I got from the newsgroups which moves
files from one location to another.
Sub MoveForPrint()
Dim i As Integer
Dim Response As Integer, TotalFiles As Integer
Dim counter As Integer
On Error Resume Next
'This part of the routine copies all files and subfolders from sFolder to
sPrintFolder.
'Note: If sPrintFolder already exist it will overwrite existing files in
this folder
'if sPrintFolder not exist it will be made for you.
'test locations
'sFolder = "C:\Orig" '<< Change
'sPrintFolder = "C:\Destination\ToPrint" '<< Change
'U Drive test
'sFolder = "U:\WT Business Services\Print Unit\Victim Letters"
'<< Change
'sPrintFolder = "U:\WT Business Services\Print Unit\Victim
Letters\ToPrint" '<< Change
sFolder = "U:\EA Kirklees\Management Support\Victims\Victim Letters"
'<< Change
sPrintFolder = "U:\EA Kirklees\Management Support\Victims\Victim
Letters\ToPrint" '<< Change
'If you want to create a backup of your folder every time you run this
macro
'you can create a unique folder with a Date/Time stamp.
'sPrintFolder = "C:\" & Format(Now, "dd-mmm-yy h-mm-ss")
If Right(sFolder, 1) = "\" Then
sFolder = Left(sFolder, Len(sFolder) - 1)
End If
If Right(sPrintFolder, 1) = "\" Then
sPrintFolder = Left(sPrintFolder, Len(sPrintFolder) - 1)
End If
Set FSO = CreateObject("scripting.filesystemobject")
If FSO.FolderExists(sFolder) = False Then
MsgBox sFolder & " doesn't exist"
Exit Sub
End If
FSO.CopyFolder Source:=sFolder, Destination:=sPrintFolder
'MsgBox "You can find the files and subfolders from " & sFolder & " in "
& sPrintFolder
MsgBox ("The documents have been moved for printing."), vbInformation, ""
End Sub
The code works fine on the 'C:\Drive but when I run it on the network drives
it seems to work, but it removes the files form the original location and
looses all the files!
I have checked the filepaths and they seem to be correct!
Can someone assist me with a solution whether it be a alteration to this
code or an alternative, please?