Excelの起動
「プロジェクト」 - 「参照設定」
Public ExcelApp As Excel.Application '---------- 'Excel起動 ---------- Public Function ExcelInit() On Error Resume Next Set ExcelApp = GetObject(, "Excel.Application") If Err Then Set ExcelApp = CreateObject("Excel.Application") Err.Clear End If ExcelApp.Visible = True Debug.Print ExcelApp.Version End Function '---------- サンプル ---------- Public Sub Module_() 'Excel起動 Call ExcelInit Dim ExBk As Workbook Dim ExSt As Worksheet Set ExBk = ExcelApp.ActiveWorkbook Set ExSt = ExcelApp.ActiveSheet 'Excel解放 Set ExcelApp = Nothing Exit Sub End Sub