View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default activating excel from VB

Mahesh,

Try something like

Dim XLApp As Excel.Application
On Error Resume Next
Set XLApp = GetObject(, "Excel.Application")
If XLApp Is Nothing Then
Set XLApp = CreateObject("Excel.Application")
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"mahesh " wrote in
message ...
Hello there,

I'm running a VB program that call excel and manipulates

workbooks and
I use the following code to get excel open from VB.

Dim xlapp As excel.Application
Set xlapp = CreateObject("excel.application")

However this always results in a new Excel instance and ignores

any
already open instances of excel. I would like an existing

instance to
be activated and if none exists, open a new one.

Is this possible?

Mahesh


---
Message posted from http://www.ExcelForum.com/