Private Sub Command1_Click() '确认数据备份 Dim s As String s = MsgBox("准备好了吗?", vbYesNo + vbQuestion, "提示") If s = vbNo Then Exit Sub End If On Error GoTo errprompt Me.MousePointer = 11 If Dir(Text1.Text & ":\数据备份", vbDirectory) = "" Then MkDir Text1.Text & ":\数据备份" Set bf = CreateObject("Scripting.FileSystemObject") bf.CopyFile App.Path & "\system.dll", Text1.Text & ":\数据备份\system" & Date & ".dll" Me.MousePointer = 0 s = MsgBox("数据已备份完毕!", vbInformation, "提示") errprompt: Me.MousePointer = 0 Select Case Err.Number Case 57 s = MsgBox("磁盘已满!", vbCritical, "提示") Case 70 s = MsgBox("磁盘写保护!请回到原文件进行复制system.dll", vbCritical, "提示") End Select Else On Error GoTo errprompt1 Set bf = CreateObject("Scripting.FileSystemObject") bf.CopyFile App.Path & "\system.dll", Text1.Text & ":\数据备份\system" & Date & ".dll" Me.MousePointer = 0 s = MsgBox("数据已备份完毕!", vbInformation, "提示") errprompt1: Me.MousePointer = 0 Select Case Err.Number Case 57 s = MsgBox("磁盘已满!", vbCritical, "提示") Case 70 s = MsgBox("磁盘写保护!请回到原文件进行复制system.dll", vbCritical, "提示") End Select End If End Sub
Dim s As String
s = MsgBox("准备好了吗?", vbYesNo + vbQuestion, "提示")
If s = vbNo Then
Exit Sub
End If
On Error GoTo errprompt
Me.MousePointer = 11
If Dir(Text1.Text & ":\数据备份", vbDirectory) = "" Then
MkDir Text1.Text & ":\数据备份"
Set bf = CreateObject("Scripting.FileSystemObject")
bf.CopyFile App.Path & "\system.dll", Text1.Text & ":\数据备份\system" & Date & ".dll"
Me.MousePointer = 0
s = MsgBox("数据已备份完毕!", vbInformation, "提示")
errprompt:
Me.MousePointer = 0
Select Case Err.Number
Case 57
s = MsgBox("磁盘已满!", vbCritical, "提示")
Case 70
s = MsgBox("磁盘写保护!请回到原文件进行复制system.dll", vbCritical, "提示")
End Select
Else
On Error GoTo errprompt1
Set bf = CreateObject("Scripting.FileSystemObject")
bf.CopyFile App.Path & "\system.dll", Text1.Text & ":\数据备份\system" & Date & ".dll"
Me.MousePointer = 0
s = MsgBox("数据已备份完毕!", vbInformation, "提示")
errprompt1:
Me.MousePointer = 0
Select Case Err.Number
Case 57
s = MsgBox("磁盘已满!", vbCritical, "提示")
Case 70
s = MsgBox("磁盘写保护!请回到原文件进行复制system.dll", vbCritical, "提示")
End Select
End If
End Sub