>
Every time i run the code it ends up creating the excel object.
Well OF COURSE it works like you said!
Code:
Private Sub GetExcel()
Dim myxl As New Excel.Application
The NEW operator *specifically* is used to CREATE AN INSTANCE of the specified class!!!
So every time you use NEW, you are asking to create something...in this case, Excel!
All you had to do was get rid of the NEW:
Code:
Private Sub GetExcel()
Dim myxl As Excel.Application
But please, please, please stop using ON ERROR RESUME NEXT. I can't believe MicroSloppy was crazy enough to leave that in
VB.NET!