I'm using VBA Excel 2010 which allows several instances of the Excel app to be open at the same time. I need to import data from workbook2 (which is open in a different Excel app), into workbook1 which is in the current Excel app. I have found that APPACTIVATE will determine if workbook2 is in fact open or not, even if in a different Excel app. If not currently open, it's easy...I just open workbook2 within the current Excel app, get my data, update workbook1 then close workbook2. But if workbook2 is already open, I need to switch to the workbook2 app, get my data, update workbook1 and leave the workbook2 untouched. Is there anyway I can access workbook2 app?
Sub AppAct()
'Workbook (1): workbook.name="Book1"
'Workbook (2): workbook.name="Fuel2010I.xlsm"
'Workbook (2): workbook.fullname="C:\FltTools\Fuel2010I.xlsm"
'Sheets("FL") exists in Workbook (2)
'Sheets("S") exists in Workbook (1)
On Error Resume Next
AppActivate ("FUEL2010I.xlsm")
If Err.Number > 0 Then 'if workbook not already open, then open it and select sheet "FL"
On Error GoTo 0
Workbooks.Open Filename:="C:\FltTools\Fuel2010I.xlsm"
Sheets("FL").Select 'works fine
Else 'if the workbook is open, select sheet "FL"
On Error GoTo 0
Sheets("FL").Select 'Subscript out of range, I'm not talking with FUEL2010I.xlsm
End If
Sheets("S").select
End Sub
I've tried the code as above. The code does not switch to the workbook2 instance of Excel