Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Installing Addin via Automation

I have an addin that I know functions correctly under normal
circumstances. If I manually add the addin via the excel UI, the
application addin installs correctly.

However, if I attempt to install the addin via automation, the
Workbook_AddinInstall method does not seem to run or at least does not
report errors back to the UI. I'm using the following code:

Dim oXL
Dim oAddin
Set oXL = CreateObject("Excel.Application")

oXL.Workbooks.Add
Set oAddin = oXL.AddIns.Add("C:\Program
Files\Company\Product\MacroFiles\Macro.xla")

oAddin.Installed = True

With this code the macro is automatically added in, but the
AddinInstall method clearly never runs or at least errors. For a
correct install I need this method to run. Any thoughts on this would
be greatly appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Installing Addin via Automation


Good evening Aragorn

Just a shot in the dark, Aragorn, but the code you're using isn't b
any chance saved as an add-in is it (ie, with no worksheet visible)?
If it is, then that's the problem. Excel likes to have a workshee
visible before it will allow a macro to start tinkering with the add-i
settings.

But if that's not the case then I don't know I'm afraid...

HTH

Dominic

--
dominic
-----------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...fo&userid=1893
View this thread: http://www.excelforum.com/showthread.php?threadid=47955

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Installing Addin via Automation

dominicb,

I'm not quite sure what you mean, so I'll describe to you how I have it
set up. The vba project is saved as a .xla file. This xla contains a
VBA macro project with Sheet1, Sheet2, Sheet3, and ThisWorkBook as
objects. ThisWorkbook implements

Sub Workbook_AddinInstall()

The method adds several menu options and definitely runs when I manual
select it in excel. The script below never seems to result in the
AddinInstall method being run. I'm assuming that you're at least on
trace to some degree. I'm very new to all of this, so you're insite is
definitely helpful. Thanks.

dominicb wrote:
Good evening Aragorn

Just a shot in the dark, Aragorn, but the code you're using isn't by
any chance saved as an add-in is it (ie, with no worksheet visible)?
If it is, then that's the problem. Excel likes to have a worksheet
visible before it will allow a macro to start tinkering with the add-in
settings.

But if that's not the case then I don't know I'm afraid...

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=479551


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Installing Addin via Automation

For me the AddinInstall event runs with your method.

Do you have any other instance of Excel open when you create your new
instance. If so, certain changes will only persist after closing the last
instance, and assuming changes were made in that instance.

Might be worth testing with GetObject (under On Error Resume Next) before
using CreateObject. This alone is not foolproof.

Regards,
Peter T



"Aragorn" wrote in message
oups.com...
dominicb,

I'm not quite sure what you mean, so I'll describe to you how I have it
set up. The vba project is saved as a .xla file. This xla contains a
VBA macro project with Sheet1, Sheet2, Sheet3, and ThisWorkBook as
objects. ThisWorkbook implements

Sub Workbook_AddinInstall()

The method adds several menu options and definitely runs when I manual
select it in excel. The script below never seems to result in the
AddinInstall method being run. I'm assuming that you're at least on
trace to some degree. I'm very new to all of this, so you're insite is
definitely helpful. Thanks.

dominicb wrote:
Good evening Aragorn

Just a shot in the dark, Aragorn, but the code you're using isn't by
any chance saved as an add-in is it (ie, with no worksheet visible)?
If it is, then that's the problem. Excel likes to have a worksheet
visible before it will allow a macro to start tinkering with the add-in
settings.

But if that's not the case then I don't know I'm afraid...

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile:

http://www.excelforum.com/member.php...o&userid=18932
View this thread:

http://www.excelforum.com/showthread...hreadid=479551



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Installing Addin via Automation

Peter,

I only expect that instance of excel to be open at install time, but
even another instance exists, I think it's reasonable that the user
won't expect excel to reflect its changes until excel has to be
reloaded in memory. That's all cool and isn't what I'm seeing.

How do you know for certain that the AddinInstall event is running. My
script does add the addin, it just doesn't add my menu items for me.
I'm assuming that you set up some dummy project. If so, can I see it.

Aaron

Peter T wrote:
For me the AddinInstall event runs with your method.

Do you have any other instance of Excel open when you create your new
instance. If so, certain changes will only persist after closing the last
instance, and assuming changes were made in that instance.

Might be worth testing with GetObject (under On Error Resume Next) before
using CreateObject. This alone is not foolproof.

Regards,
Peter T



"Aragorn" wrote in message
oups.com...
dominicb,

I'm not quite sure what you mean, so I'll describe to you how I have it
set up. The vba project is saved as a .xla file. This xla contains a
VBA macro project with Sheet1, Sheet2, Sheet3, and ThisWorkBook as
objects. ThisWorkbook implements

Sub Workbook_AddinInstall()

The method adds several menu options and definitely runs when I manual
select it in excel. The script below never seems to result in the
AddinInstall method being run. I'm assuming that you're at least on
trace to some degree. I'm very new to all of this, so you're insite is
definitely helpful. Thanks.

dominicb wrote:
Good evening Aragorn

Just a shot in the dark, Aragorn, but the code you're using isn't by
any chance saved as an add-in is it (ie, with no worksheet visible)?
If it is, then that's the problem. Excel likes to have a worksheet
visible before it will allow a macro to start tinkering with the add-in
settings.

But if that's not the case then I don't know I'm afraid...

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile:

http://www.excelforum.com/member.php...o&userid=18932
View this thread:

http://www.excelforum.com/showthread...hreadid=479551




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Installing Addin via Automation

Hi Aaron,

I only expect that instance of excel to be open at install time, but
even another instance exists, I think it's reasonable that the user
won't expect excel to reflect its changes until excel has to be
reloaded in memory. That's all cool and isn't what I'm seeing.


With two instances, try customizing your toolbar in one then close this
customized instance, then close the other one. Re-start Excel, no customized
toolbar - right. Similar for various other application settings.

How do you know for certain that the AddinInstall event is running. My
script does add the addin, it just doesn't add my menu items for me.
I'm assuming that you set up some dummy project. If so, can I see it.


In the "event of a test addin, I put

Debug.? "AddinInstall"

In the script (in a Word module) I added

oXl.Visible = true
Stop

looked in the xl's immediate window and there it was!

then back in Word I stepped through closing the instance and releasing
variables.

Regards,
Peter T

"Aragorn" wrote in message
oups.com...
Peter,

I only expect that instance of excel to be open at install time, but
even another instance exists, I think it's reasonable that the user
won't expect excel to reflect its changes until excel has to be
reloaded in memory. That's all cool and isn't what I'm seeing.

How do you know for certain that the AddinInstall event is running. My
script does add the addin, it just doesn't add my menu items for me.
I'm assuming that you set up some dummy project. If so, can I see it.

Aaron

Peter T wrote:
For me the AddinInstall event runs with your method.

Do you have any other instance of Excel open when you create your new
instance. If so, certain changes will only persist after closing the

last
instance, and assuming changes were made in that instance.

Might be worth testing with GetObject (under On Error Resume Next)

before
using CreateObject. This alone is not foolproof.

Regards,
Peter T



"Aragorn" wrote in message
oups.com...
dominicb,

I'm not quite sure what you mean, so I'll describe to you how I have

it
set up. The vba project is saved as a .xla file. This xla contains a
VBA macro project with Sheet1, Sheet2, Sheet3, and ThisWorkBook as
objects. ThisWorkbook implements

Sub Workbook_AddinInstall()

The method adds several menu options and definitely runs when I manual
select it in excel. The script below never seems to result in the
AddinInstall method being run. I'm assuming that you're at least on
trace to some degree. I'm very new to all of this, so you're insite is
definitely helpful. Thanks.

dominicb wrote:
Good evening Aragorn

Just a shot in the dark, Aragorn, but the code you're using isn't by
any chance saved as an add-in is it (ie, with no worksheet visible)?
If it is, then that's the problem. Excel likes to have a worksheet
visible before it will allow a macro to start tinkering with the

add-in
settings.

But if that's not the case then I don't know I'm afraid...

HTH

DominicB


--
dominicb

------------------------------------------------------------------------
dominicb's Profile:

http://www.excelforum.com/member.php...o&userid=18932
View this thread:

http://www.excelforum.com/showthread...hreadid=479551




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
Referencing a com addin from a .net application via ole automation Luke Excel Programming 3 August 26th 05 01:39 PM
addIn functions in automation nicgendron Excel Programming 1 July 14th 05 10:35 AM
Automation COM Addin with Excel Puneet Excel Programming 0 July 12th 04 07:50 PM
Addin Not Installing zSplash Excel Programming 3 April 15th 04 07:40 PM
unknown menu appear when installing an AddIn Carl Excel Programming 0 December 23rd 03 09:19 AM


All times are GMT +1. The time now is 01:43 AM.

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"