Tim
VB(A) (COM)Automation is alwasy synchronous so there is no difference
between out of process Automation(VB or in process(VBA) Automation.
*Your* Ontime could work, although I would be interested to know when
excel would be idle enough so it could start the OnTime procedure. I
would suggest something tricky like this:
Dim XLApp Dim wb
Set XLApp = CreateObject("Excel.Application")
XLApp.Visible = True 'why would you do this? Users would just get
confused, I would use False instead until you've got something to show
XLApp.Interactive = False 'prevent users from fooling around with excel
XLApp.Ignoreremoterequest = false 'prevents other apps from fooling
around with excel
XLApp.UserControl = True ' allows excel to run even when XLApp object
reference is cleared.
set wb = XLApp.workbooks.open("C:\temp\Report_1.xlt" )
XLApp.OnTime NOW() + 5seconds , "Module1.ImportData", "dump.txt"
set wb = nothing
set XLApp = nothing (excel should not quit!), but shoud now become
idle (and run the onTime Proc)
'Do other stuff.
set wb = GetObject(,"C:\temp\Report_1.xlt" )'connect back to the
running excel through the workbook. this works even if other excel
instances are active as well
set XLApp = wb.parent
' note that you need to be sure that Excel is done with the Ontime,
else your VB process will now hang!
' do more stuff with excel
XLApp .Quit 'Excel will quit
BTW maybe DDE would work also, I have never tried this.
Dm Unseen