tfb2.bas
来自「此程序是完成的土方调配」· BAS 代码 · 共 44 行
BAS
44 行
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 + =
减小字号Ctrl + -
显示快捷键?