RE: Determine hoe excel was launched



Hi Tim,

Thanks for your posting!

From your description, I understand that you want to tell if the Excel is
lauched by double click a xls file or type Excel.exe to execute it directly
from within the Excel Com Addin.

Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

Based on my research, so far from the Addin method, it did not provide such
a parameter to tell from the two behavior.
Public Sub OnConnection(ByVal application As Object, ByVal connectMode As
Extensibility.ext_ConnectMode, ByVal addInInst As Object, ByRef custom As
System.Array) Implements Extensibility.IDTExtensibility2.OnConnection

The last parameter custom will only tell if the Excel is lauched by any of
the three possibility.
1. By User(double click xls or run excel.exe)
2. By OLE( open an xls file in IE or other activex document container)
3. By Automation(Use Code,e.g CreateObject to launch Excel)

But for the two scenarios you care, it will always return 1 means, By User.

So why you need to detect that? Maybe there is a workaround.

Based on my research, for the two scenario the code below may differ.
applicationObject.ActiveWorkBook.Path.ToString()

If we launch Excel.exe, it will open a blank workbook, and now the Path is
empty because we have not saved it.

If we double click a xls file, the Path will be the path to the physical
path of the xls.

So that may give you some hint.

But the method have many limitations, if we call it too early, the
ActiveWorkBook is empty.

You may have a try according to your concrete scenario, if you still have
any concern, please feel free to post here.

Thanks!

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| Thread-Topic: Determine hoe excel was launched
| thread-index: AcaV82R9Re48ytaQQNG6oOWQ3OESIA==
| X-WBNR-Posting-Host: 88.110.52.57
| From: =?Utf-8?B?VGltIE1hcnNkZW4=?= <TMQSL@xxxxxxxxxxxxxxxx>
| Subject: Determine hoe excel was launched
| Date: Thu, 22 Jun 2006 05:00:02 -0700
| Lines: 10
| Message-ID: <C36391D3-D852-4D1C-94E0-F6EFB0C01865@xxxxxxxxxxxxx>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830
| Newsgroups: microsoft.public.office.developer.com.add_ins
| Path: TK2MSFTNGXA01.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.office.developer.com.add_ins:11459
| NNTP-Posting-Host: TK2MSFTNGXA01.phx.gbl 10.40.2.250
| X-Tomcat-NG: microsoft.public.office.developer.com.add_ins
|
| Hi,
|
| How do I determine if excel was launch by double clicking a workbook, or
by
| running the excel.exe.
| I need this info within my vb.net com addin.
|
| Thanks
|
| --
| Tim Marsden
|

.



Relevant Pages

  • Re: Macro -->shared.xls --> .xla add-in --> now not in macro list
    ... If I start excel by clicking on the excel icon on my desktop, ... If I start excel by doubleclicking on a .xls file, the addin is loaded. ... all workbooks, including specifically existing workbooks. ...
    (microsoft.public.excel)
  • Re: How to use automation Add-In to replace Excel macros!!
    ... from the tools menu earlier, when the excel is launched from my application, ... somehow the AddIn functions are not accessible when I launch excel from my ... way to forcibly launch the Add-I? ... "Tom Ogilvy" wrote: ...
    (microsoft.public.excel.programming)
  • RE: Disable AddIn via automation
    ... I run an Excel in Word using the COM automation API: ... My issue is that this Excel instance is using an addin I wrote, ... I'd like to launch an Excel ...
    (microsoft.public.excel.programming)
  • RE: Disable AddIn via automation
    ... If x = 0 Then Exit Sub ... I run an Excel in Word using the COM automation API: ... My issue is that this Excel instance is using an addin I wrote, ... I'd like to launch an Excel ...
    (microsoft.public.excel.programming)
  • RE: Disable AddIn via automation
    ... Dim AddinsList() As String ... I run an Excel in Word using the COM automation API: ... My issue is that this Excel instance is using an addin I wrote, ... I'd like to launch an Excel ...
    (microsoft.public.excel.programming)