I want to check if Excel is running. If that is the case I want to check each workbook if there are 4 sheets with the names I specify and when true I want to access those sheets.
Is this possible?
I can't find a way to interact with a running Excel.
Printable View
I want to check if Excel is running. If that is the case I want to check each workbook if there are 4 sheets with the names I specify and when true I want to access those sheets.
Is this possible?
I can't find a way to interact with a running Excel.
VB Code:
Dim XLS As Object Private Function GetExcel() As Boolean On Error GoTo NotRunning Set XLS = GetObject(, "Excel.Application") GetExcel = True Exit Function NotRunning: Set XLS = Nothing GetExcel = False End Function Private Sub Form_Load() If GetExcel Then For x = 1 To XLS.Workbooks.Count For i = 1 To XLS.Workbooks(x).sheets.Count Debug.Print XLS.Workbooks(x).Name & ": " & XLS.Workbooks(x).sheets(i).Name Next Next Else Debug.Print "Excel is not running" End If End Sub