ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Saving Addin (https://www.excelbanter.com/excel-discussion-misc-queries/98465-saving-addin.html)

Rutgers_Excels

Saving Addin
 

I've created a workbook that has several macros which are linked to
excel menu items. I am trying to programatically save this workbook as
an addin to my xlStart folder. However, the bit of code that I'm using
doesn't seem to be working correctly (or at least how I thought it
would). What I thought would happen is that this addin would open up
in the background. However, everytime I open up Excel, the workbook
opens up. Is this because it is saving as an Excel workbook and not an
addin? Any ideas?

Application.DisplayAlerts = False
fName = "C:\Program Files\Microsoft
Office\Office\XLStart\Custom.xla"
Call ActiveWorkbook.SaveAs(fName, xlAddIn)
Application.Quit


--
Rutgers_Excels
------------------------------------------------------------------------
Rutgers_Excels's Profile: http://www.excelforum.com/member.php...fo&userid=8973
View this thread: http://www.excelforum.com/showthread...hreadid=560065


Dave Peterson

Saving Addin
 
I'd use something like:

Option Explicit
Sub testme()
Dim fName As String
fName = Application.StartupPath & "\" & "custom.xla"
With ThisWorkbook
.IsAddin = True
Application.DisplayAlerts = False
.SaveAs Filename:=fName
Application.DisplayAlerts = True
End With
End Sub


Don't store the .xls in that XLStart folder, either.

Rutgers_Excels wrote:

I've created a workbook that has several macros which are linked to
excel menu items. I am trying to programatically save this workbook as
an addin to my xlStart folder. However, the bit of code that I'm using
doesn't seem to be working correctly (or at least how I thought it
would). What I thought would happen is that this addin would open up
in the background. However, everytime I open up Excel, the workbook
opens up. Is this because it is saving as an Excel workbook and not an
addin? Any ideas?

Application.DisplayAlerts = False
fName = "C:\Program Files\Microsoft
Office\Office\XLStart\Custom.xla"
Call ActiveWorkbook.SaveAs(fName, xlAddIn)
Application.Quit

--
Rutgers_Excels
------------------------------------------------------------------------
Rutgers_Excels's Profile: http://www.excelforum.com/member.php...fo&userid=8973
View this thread: http://www.excelforum.com/showthread...hreadid=560065


--

Dave Peterson


All times are GMT +1. The time now is 12:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com