ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to load Excel startup files through code (https://www.excelbanter.com/excel-programming/360453-how-load-excel-startup-files-through-code.html)

e'[email protected]

How to load Excel startup files through code
 
Hi,

I'm trying to open up an Excel file (.xls) through code. That file
uses some function located in a Excel Add-in file(.xla). Everything is
fine if I open up that file directly in Excel and the startup file is
specified under Tools-Options-General. However, when I try to open
up the .xls file through code, the add-in file isn't open and so I get
errors in my .xls file. Does anyone know how I can load the startup
files through code?

Thanks!
E'Kong


Chip Pearson

How to load Excel startup files through code
 
When you start Excel through code, it doesn't run its startup
procedures, in order to minimize startup time. You'll have to run
startup procedures manually from your code. E.g,

Sub Workbook_Open()
Dim FName As String
Application.AddIns("Analysis ToolPak").Installed = True
FName = Dir(Application.Path & "XLStart\*.xls")
Do Until FName = ""
Workbooks.Open Application.Path & "XLStart\" & FName
FName = Dir()
Loop
FName = Dir(Application.AltStartupPath & "\*.xls")
Do Until FName = ""
Workbooks.Open Application.AltStartupPath & "\" & FName
FName = Dir()
Loop
End Sub

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com






wrote in message
ups.com...
Hi,

I'm trying to open up an Excel file (.xls) through code. That
file
uses some function located in a Excel Add-in file(.xla).
Everything is
fine if I open up that file directly in Excel and the startup
file is
specified under Tools-Options-General. However, when I try
to open
up the .xls file through code, the add-in file isn't open and
so I get
errors in my .xls file. Does anyone know how I can load the
startup
files through code?

Thanks!
E'Kong





All times are GMT +1. The time now is 05:43 PM.

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