Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default activating excel from VB

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/

  #2   Report Post  
Posted to microsoft.public.excel.programming
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/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Activating object from Excel cell Amnon Wilensky Excel Worksheet Functions 2 March 29th 09 06:46 PM
Close Excel server after activating OLE object Goofball Excel Discussion (Misc queries) 1 March 13th 08 05:32 PM
Excel: "De-activating" an e-mail address cell? HowdyPete Excel Discussion (Misc queries) 2 August 17th 06 04:18 PM
How to hide Excel window when activating a Shape object Yi[_2_] Excel Programming 4 October 8th 03 02:36 PM
How to hide Excel window when activating a Shape object Bob Kilmer Excel Programming 0 September 27th 03 03:51 PM


All times are GMT +1. The time now is 06:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"