Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to move a file from one folder to another - or at least copy and
delete the old file. I get an error 58 file already exists, and don't know why? Public Sub MoveFiles(ByVal Source As String, ByVal Destination As String) Dim oFSO As Object Set oFSO = CreateObject("Scripting.FileSystemObject") With oFSO If .FileExists(Source) Then ..MoveFile Source, Destination Else MsgBox Source & " Doesn't Exist", vbExclamation End If End With Set oFSO = Nothing End Sub Sub RunThroughList() Dim I As Long Dim Destination As String Dim Lastrow As Long Lastrow = Worksheets(1).Cells(Rows.Count, 1).End(xlUp).Row For I = 1 To Lastrow MoveFiles Range("A" & I).Value, "C:\Output" Next End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Check if a sheet exists in a file, without opening that file | Excel Programming | |||
Error - file already exists. | Excel Programming | |||
Error if 'name' already exists | Excel Programming | |||
File Name Exists Error Trap | Excel Programming | |||
the file already exists - do you want to replace the existing file? | Excel Programming |