lmb.bas

来自「lmb--路面工程数量计算软件」· BAS 代码 · 共 53 行

BAS
53
字号
Attribute VB_Name = "Module2"
Option Explicit
Sub Qquit_Excel()
    xlbook.Save
    Set xlsheet1 = Nothing
    Set xlsheet2 = Nothing
    Set xlsheet3 = Nothing
    Set xlsheet4 = Nothing
    Set xlsheet5 = Nothing
    xlbook.Parent.Quit
    Set xlbook = Nothing
End Sub
Sub ckbg()
        xlbook.Application.Visible = True
        xlbook.Windows(1).Visible = True
End Sub
Sub iniExcel()
    On Error GoTo ErrorTrap
    Set xlbook = GetObject(App.Path & "\lmbb.xls")
    Set xlsheet1 = xlbook.Worksheets("原始数据")
    Set xlsheet2 = xlbook.Worksheets("路面1")
    Set xlsheet3 = xlbook.Worksheets("路面2")
    Set xlsheet4 = xlbook.Worksheets("Sheet4")
    Exit Sub
ErrorTrap:
    Select Case Err.Number
        Case 432        '文件未找到
            Dim Response
            Response = MsgBox _
                ("无法在默认路径找到“lmb.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("原始数据")
                    Set xlsheet2 = xlbook.Worksheets("路面1")
                    Set xlsheet3 = xlbook.Worksheets("路面2")
                    Set xlsheet4 = xlbook.Worksheets("Sheet4")
                Else
                    End
                End If
            Else
                End
            End If
        Case Else
            End
    End Select
End Sub

⌨️ 快捷键说明

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