I am having a challenge where I need to include two searches for file names in my VBA code.
The code does like like the 2nd reference to the DIR statement and errors out.
[codebox]Example:
strFileName = Dir(MyFirstPath & MyFile)
While strFileName “”
‘Change File Attributes/Delete existing File
Results = Dir(MyPath & MyFile)
If Results = “” Then
‘Do Nothing
Else
SetAttr “” & MyPath & MyFile & “”,vbNormal
Kill MyPath & MyFile
End If
‘Now copy newer file to MyPath
Run some code to copy newer file to MyPath
WEnd
[/codebox]
Your suggestions are appreciated,
John