📄 modsave.bas
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -