求教VBA问题,如何让word在另存关闭

如题所述

Private Function SaveAsFile(ByVal fileFormat As String)

    Dim strDocName As String
    Dim intPos As Integer
    'Find position of extension in filename
    strDocName = ActiveDocument.Name
    intPos = InStrRev(strDocName, ".")
    If intPos = 0 Then
        'If the document has not yet been saved
        'Ask the user to provide a filename
        strDocName = InputBox("Please enter the name of your document.")
    Else
        'Strip off extension
        strDocName = Left(strDocName, intPos - 1)
        strDocName = strDocName & fileFormat
    End If
    'Save file with new extension
    ActiveDocument.SaveAs fileName:=strDocName, fileFormat:=wdFormatText
    'Close active document
    ActiveDocument.Close SaveChanges:=wdSaveChanges, OriginalFormat:=wdOriginalDocumentFormat
    
End Function
温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网