|
-
Aug 30th, 2000, 11:36 PM
#1
Thread Starter
New Member
Hi guys!
I have a problem here. I am exporting the contents of an ADO recorset to an Excel Sheet, and I want to know if there is a way of using an existing excel window wich is already opened to create the new sheet or is it really necessary to create a new instance of the Excel.Application object.
Thank you in advance
-
Aug 30th, 2000, 11:40 PM
#2
Conquistador
it would probably be easier, to just create a new instance
-
Aug 30th, 2000, 11:48 PM
#3
Thread Starter
New Member
yes, I know that instantiating again is much easier, in fact that´s what I am doing now.
But in my case it would really be nice if I could use the already opened instance, because my application export data very often and opening excel on every time isn´t a good idea, right?
Just wanted to know if there´s a way
thank you anyway
-
Aug 30th, 2000, 11:57 PM
#4
Conquistador
you could open one excel instance for the duration of the execution of your application. I.e at the start open it, when it's closed, close it and maybe have it invisible
-
Aug 31st, 2000, 12:05 AM
#5
Thread Starter
New Member
yeah, that would solve, I´ve already thought about it, but what I want to know is if it is possible, you see, I can work my problem out, I just want to do THAT WAY
-
Aug 31st, 2000, 01:39 AM
#6
Hyperactive Member
You would use the GetObjects command to get an opened version of excel. However, this will take the first opened instance of excel, so if there is more then one version opened, then you might run into problems.
Code:
Private Sub Command2_Click()
Dim objExcel As Excel.Application
Dim objWorkSheet As Excel.Workbook
Dim objSheet As Excel.Worksheet
Set objExcel = GetObject(, "Excel.Application")
Set objSheet = objExcel.ActiveWorkbook.ActiveSheet
objSheet.Range("A1").Value = "hi"
DoEvents
objExcel.Quit
End Sub
-
Aug 31st, 2000, 04:43 AM
#7
Conquistador
you could also work out how to use handles, then you could detect the open windows, and if excel was open
-
Aug 31st, 2000, 11:09 PM
#8
Thread Starter
New Member
thank you reeset. Helped a lot.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|