📄 tfb2.bas
字号:
Attribute VB_Name = "Module2"
Option Explicit
Sub Qquit_Excel()
xlbook.Save
Set xlsheet1 = Nothing
Set xlsheet2 = Nothing
Set xlsheet3 = Nothing
xlbook.Parent.Quit
Set xlbook = Nothing
End Sub
Sub iniExcel()
On Error GoTo ErrorTrap1
Set xlbook = GetObject(App.Path & "\tfb.xls")
Set xlsheet1 = xlbook.Worksheets("Sheet1")
Set xlsheet2 = xlbook.Worksheets("Sheet2")
Exit Sub
ErrorTrap1:
Select Case Err.Number
Case 432 '文件未找到
Dim Response
Response = MsgBox _
("无法在默认路径找到“tfb.xls”,您是否进行手工查找?" _
, vbYesNo + vbCritical, "运行错误")
If Response = vbYes Then
Form1.cmDialog.Filter = "工作薄文件(*.xls)|*.xls|所有文件(*.*)|*.*"
Form1.cmDialog.InitDir = App.Path
Form1.cmDialog.ShowOpen
If Form1.cmDialog.filename <> "" Then
Set xlbook = GetObject(Form1.cmDialog.filename)
Set xlsheet1 = xlbook.Worksheets("sheets1")
Set xlsheet2 = xlbook.Worksheets("sheets2")
Else
End
End If
Else
End
End If
Case Else
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -