PSS ID Number: 108888
Article Last Modified on 8/15/2003
The information in this article applies to:
- Microsoft Excel 97 for Windows
- Microsoft Visual Basic for Applications
This article was previously published under Q108888
SYMPTOMS
When you access Microsoft Excel as an OLE Automation object using the
CreateObject command, add-ins, files located in the XLStart directory, and
the default new workbook are not loaded.
CAUSE
Add-ins, files in the XLStart directory, and the default new workbook are
not loaded when Microsoft Excel is run as an OLE Automation object using
the CreateObject command. This is by design. When add-ins and files are
loaded, Microsoft Excel sends a message to the calling application, such as
Visual Basic, that it is not ready to respond to the request and to try
again later. The calling application may not be able to handle this
request, and will not be able to continue with the rest of the commands.
WORKAROUND
Microsoft provides programming examples for illustration only, without warranty either
expressed or implied, including, but not limited to, the implied warranties of
merchantability and/or fitness for a particular purpose. This article assumes
that you are familiar with the programming language being demonstrated and the
tools used to create and debug procedures. Microsoft support professionals can
help explain the functionality of a particular procedure, but they will not
modify these examples to provide added functionality or construct procedures to
meet your specific needs. If you have limited programming experience, you may
want to contact a Microsoft Certified Partner or the Microsoft fee-based
consulting line at (800) 936-5200. For more information about Microsoft Certified
Partners, please visit the following Microsoft Web site:
For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:
To load an add-in file when you run Microsoft Excel as an OLE Automation
object, load the add-in manually. The following is an example of using this
method:
Sub LoadAddin()
' Dimension variable xl as object type.
Dim xl As Object
' Activate Microsoft Excel and assign to variable xl.
Set XL = CreateObject("Excel.Application")
' Open the add-in file you want, in this example, XLQUERY.XLA.
XL.Workbooks.Open (XL.librarypath & "\MSQUERY\XLQUERY.XLA")
' If you need to register the functions and commands
' contained in a resource (XLL), use the RegisterXLL method.
' In the example below, all functions of Analys32.xll are
' registered.
' XL.RegisterXLL "Analys32.xll"
' Run any auto macros contained in the add-in file
' Auto macros don't run when you open a file
' using the Open method.
XL.Workbooks("xlquery.xla").RunAutoMacros 1
Set XL = Nothing
End Sub
MORE INFORMATION
Because Microsoft Excel does not load add-ins or files in the XLStart
directory when you call it as an OLE Automation object, you have complete
control of the loading process. If you want an add-in loaded, you can load
it manually. This behavior also means that no macro errors, locked file
alerts, or read-only file alerts will keep Microsoft Excel from loading
when it is being called by the CreateObject command. Another benefit of
this behavior is that it takes less time to load Microsoft Excel than it
does when add-ins or files are loaded when you run Microsoft Excel.
REFERENCES
For an overview of controlling what happens when you start Microsoft Excel,
click the Search button in Help and type:
For more information about Installing Or Removing An Add-in, click
the Search button in Help and type:
For additional information about getting help with Visual Basic for
Applications, please see the following article in the Microsoft Knowledge
Base:
163435
VBA: Programming Resources for Visual Basic for Applications
Additional query words: 5.00c 8.00 97 personal.xls personal macro workbook xl97 XL
Keywords: kbdtacode kbprb kbProgramming KB108888
Technology: kbExcel97Search kbExcelSearch kbExcelWinSearch kbVBASearch kbZNotKeyword3 kbZNotKeyword6