Hi,
i've try and successful to use getobject function to get the data from excel file. But i must open excel before running this function , if not, error will occurs!
My coding:
' VpurBOM is a listbox
Dim pur_xls As Object
Set pur_xls = GetObject(VpurBOM.List(0))
pur_xls.Application.Visible = False
pur_xls.Parent.Windows(1).Visible = False
' test part
MsgBox pur_xls.Worksheets("sheet1").Range("A1").Value
' end test part
If findwindow("XLMAIN", 0) <> 0 Then
pur_xls.Application.Quit
End If
"findwindow" is a function use API to find whether excel program is running or not~!
Is that the problem i set the "application.visible = False" ?!
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement