Saving Addin

R

Rutgers_Excels

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

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

Dave Peterson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top