以下代码供楼主参考:(粘贴于活动文档的THISDOCUMETN代码窗口中)
Sub FileSave()
Dim ActDoc As String, MyDialog As FileDialog, YN As Byte, SavFile As String
On Error Resume Next
Application.ScreenUpdating = False
YN = MsgBox("你确认需要创建文档备份件*.doc吗?Yes 创建,No不创建!", vbYesNo + vbInformation + vbDefaultButton1)
Me.Save
If YN = vbNo Then
Exit Sub
Else
ActDoc = Me.FullName
Rep: Set MyDialog = Application.FileDialog(msoFileDialogSaveAs)
With MyDialog
.Title = "保存备份文件"
If .Show = -1 Then
.Execute
SavFile = .SelectedItems(1)
Else
MsgBox "您不能否定自己的选择!", vbOKOnly + vbInformation
GoTo Rep
End If
End With
Documents.Open ActDoc
Documents(SavFile).Close
End If
Application.ScreenUpdating = True
End Sub |