I think I'd check each piece:
Option Explicit
Sub testme()
Dim F As String
Dim DF As String
Dim DFFolder As String
Dim okToContinue As Boolean
okToContinue = True
F = "C:\BP View\Updates\DigDash CSVs\DDDesktop.csv"
If Dir(F) = "" Then
okToContinue = False
MsgBox F & " Not found"
End If
DFFolder = "C:\InetPub\wwwroot\dash\sla\"
If Right(DFFolder, 1) < "\" Then
DFFolder = DFFolder & "\"
End If
DF = "data.txt"
If Dir(DFFolder & "nul") = "" Then
okToContinue = False
MsgBox DFFolder & " doesn't exist"
End If
If okToContinue Then
FileCopy F, DFFolder & DF
Else
MsgBox "not copied"
End If
End Sub
And I used VBA's FileCopy, too. As long as F and DF aren't open, it seems more
straightforward to me.
Tod wrote:
I have something like this:
On Error Goto LogIt
Workbooks.Open "C:\Path\FileName.csv"
Set fso = CreateObject("Scripting.FileSystemObject")
f = "C:\BP View\Updates\DigDash CSVs\DDDesktop.csv"
df = "C:\InetPub\wwwroot\dash\sla\data.txt"
fso.CopyFile f, df
'more code
LogIt:
'Code to shut everything down.
txtStream.WriteLine (Now & ": Procedure ended early
with error " & Err.Number & " " & Err.Description)
If I get the path not found error, I don't know which path
it is talking about.
tod
-----Original Message-----
Tod,
Under what circumstances are you getting the error?
Unless your
code is specifying a path, Excel will be using CurDir
path.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"Tod" wrote in message
...
When I get an error 76, path not found, is there a way
for
the code to return which path it is talking about?
tod
.
--
Dave Peterson