modsave.bas

来自「大型商业学分统计系统原代码说明 1.如果在向导设置班级数为8时,此数值为班级总数」· BAS 代码 · 共 70 行

BAS
70
字号
Attribute VB_Name = "modsave"
Function Menu_FileSave(MAIN As Form, Optional SaveAsName As Variant) As Boolean
    On Error GoTo CxlError3 'set error trap

    If IsMissing(SaveAsName) Then
        'if no save name specified

        'if no previous name existed
        With PMAIN.CommonDialog3
            ' build default name and prompt
            .filename = PMAIN.Caption
            .Filter = "Rich Text Files (*.rtf)|*.rtf|WORD (*.doc)|*.doc"
            .Flags = cdlOFNOverwritePrompt

            ' show save file dialog
            .ShowSave
            ' set SaveAsName to dialog result
            SaveAsName = .filename
        End With

    End If

    ' save file
    PMAIN.RichTextBox1.SaveFile CStr(SaveAsName)
    ' change the caption to reflect name
    '    PMAIN.Caption = CStr(SaveAsName)
    ' set return value to true
    Menu_FileSave = True
    PMAIN.RichTextBox1.DataChanged = False
    Exit Function
CxlError3:
    ' set return value to false
    '    Menu_FileSave = False
    Exit Function
End Function
Function SAVE(MAIN As Form, Optional SaveAsName As Variant) As Boolean
    On Error GoTo CxlError3 'set error trap

    If IsMissing(SaveAsName) Then
        'if no save name specified

        'if no previous name existed
        With PMAIN.CommonDialog3
            ' build default name and prompt
            '                .FileName = "temp"
            '                .Filter = "Rich Text Files (*.rtf)|*.rtf "
            '                .Flags = cdlOFNOverwritePrompt
            '
            ' show save file dialog

            ' set SaveAsName to dialog result
            SaveAsName = App.Path & "\temp.rtf"
        End With

    End If

    ' save file
    PMAIN.RichTextBox1.SaveFile CStr(SaveAsName)
    ' change the caption to reflect name
    '    PMAIN.Caption = CStr(SaveAsName)
    ' set return value to true

    PMAIN.RichTextBox1.DataChanged = False
    Exit Function
CxlError3:
    ' set return value to false
    '    Menu_FileSave = False
    Exit Function
End Function

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?