Hello,
I'm using the following code in a EXE to open excel with vb6.0 :
Sub Main()
Dim xlapp As Excel.Application
Dim wkbKei As Excel.Workbook
Dim Key As String
'Check if file exists
If FExists(App.Path & "\Kei.xls") = True Then
'Open file
Key="test"
Set xlapp = New Excel.Application
xlapp.UserControl = True
Set wkbKei = xlapp.Workbooks.Open(App.Path & _
"Kei.xls", ReadOnly, Password:=Key)
wkbKei.RunAutoMacros xlAutoOpen
xlapp.Visible = True
'Manipulate Excel instance
xlapp.sheets("sheet1").cells(3,3)=1
'
'....
'COM1 check loop until Excel file is closed
'....
'Program end
'
'
Set wkbKei = Nothing
Set xlapp = Nothing
Key = ""
End If
End Sub
After the file is openend another module in de EXE file once in a while checks if a device
connected to com1 is still there and set a value somewhere in the excel file until the excel file is closed:
xlapp.sheets("sheet1").cells(3,3)=1
my problem is that the moment the exe file closes i like to reconnect to this excel instance,
i only do not know how..
Can anyone help me?
Borgster