' Copy from_file to to_file, raising the
' Progress event periodically.
Public Sub CopyFile(ByVal from_file As String, ByVal _
to_file As String)
' If a download is underway, complain.
If Len(m_FromFile) > 0 Then
Err.Raise fc_CopyInProgress, _
"FileCopier.CopyFile", _
"Copy already in progress"
End If
' Do not copy if the file already exists.
If Len(Dir$(to_file)) > 0 Then
Err.Raise fc_FileExists, _
"FileCopier.CopyFile", _
"File already exists"
End If
' Save the from and to file names.
m_FromFile = from_file
m_ToFile = to_file
' Start the download.
AsyncRead from_file, vbAsyncTypeFile, _
m_FromFile, vbAsyncReadForceUpdate
End Sub
|