Artikel-ID: 213489 - Produkte anzeigen, auf die sich dieser Artikel bezieht
Alles erweitern | Alles schlie▀en

Auf dieser Seite

Problembeschreibung

When you access Microsoft Excel as an OLE Automation object using the CreateObject command, add-ins, files that are located in the XLStart directory, and the default new workbook are not loaded.

Ursache

When you attempt to load add-ins and files, 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 continue with the rest of the commands.

Abhilfe

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

To load an add-in file when you run Excel as an OLE Automation object, load the add-in manually. Examples of this method are as follows.

Microsoft Office Excel 2007

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.XLAM.
   XL.Workbooks.Open (XL.librarypath & "\MSQUERY\XLQUERY.XLAM")

   ' 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.xlam").RunAutoMacros 1

   Set XL = Nothing
 End Sub
				

Microsoft Office Excel 2003 and earlier versions of Excel

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
				

Weitere Informationen

Because 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 to be loaded, you can load it manually.

This behavior also means that no macro errors, locked file alerts, or read-only file alerts keep 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 Excel than it does when add-ins or files are loaded.

Informationsquellen

For more information about how to get help with Visual Basic for Applications, click the following article number to view the article in the Microsoft Knowledge Base:
226118 List of resources that are available to help you learn Visual Basic for Applications programming

Eigenschaften

Artikel-ID: 213489 - Geńndert am: Sonntag, 18. September 2011 - Version: 2.0
Die Informationen in diesem Artikel beziehen sich auf:
  • Microsoft Office Excel 2007
  • Microsoft Excel 2002 Standard Edition
  • Microsoft Excel 2000 Standard Edition
  • Microsoft Excel 97 Standard Edition
Keywords:á
kbautomation kbvba kbexpertiseinter kbdtacode kbprb kbprogramming KB213489
Microsoft stellt Ihnen die in der Knowledge Base angebotenen Artikel und Informationen als Service-Leistung zur VerfŘgung. Microsoft Řbernimmt keinerlei Gewńhrleistung dafŘr, dass die angebotenen Artikel und Informationen auch in Ihrer Einsatzumgebung die erwŘnschten Ergebnisse erzielen. Die Entscheidung darŘber, ob und in welcher Form Sie die angebotenen Artikel und Informationen nutzen, liegt daher allein bei Ihnen. Mit Ausnahme der gesetzlichen Haftung fŘr Vorsatz ist jede Haftung von Microsoft im Zusammenhang mit Ihrer Nutzung dieser Artikel oder Informationen ausgeschlossen.

Ihr Feedback an uns

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com