The information in this article applies to:
SYMPTOMSThe CreateObject function starts a new windowless instance of Microsoft Team Manager with no open file, even if the "Open last file at startup" setting is selected. While no file is open, any attempt to use a property or method of the TeamManager.Application object, except the New or Open methods, results in an OLE Automation error. WORKAROUNDSMethod 1After using CreateObject to start Microsoft Team Manager, use the New or Open method to create or open a team file before using any other methods or properties.Method 2Use the GetObject function with a specific file name to start Microsoft Team Manager and open the specified team file.Method 3To start Microsoft Team Manager and automatically open the last file (the file most recently opened), use the Shell function. This works only if the "Open last file at startup" setting is selected and Microsoft Team Manager is not already running. After the Shell function, use the GetObject function to control Microsoft Team Manager with OLE Automation.STATUSThis behavior is by design. MORE INFORMATION
All of the following code is assumed to be in another application, such as
Microsoft Excel or Visual Basic.
This is equivalent to:
While no file is open, no method or property of the TeamManger.Application
object can be used except the New and Open methods. For example, the
following macro causes an OLE Automation error:
Using the New or Open MethodThe New method can be used to create a new team file. For example, the following macro starts Microsoft Team Manager, and then creates a new team file and saves it as File2.mtp in the folder C:\Myfiles:
NOTE: The first argument in the New method determines whether changes to
the active team file should be saved before creating the new file. It is
irrelevant in the above example because there isn't any active team file.
The Open method can be used to open an existing file. For example, the following macro starts Microsoft Team Manager, and then opens the specified file:
Using GetObject to Open a Specific FileGetObject can be used with a specific file name to start Microsoft Team Manager and open the specified file. For example, if Microsoft Team Manager is not running, the following line of code starts it and opens the specified file:
Opening the Last FileThe "Open last file at startup" setting can be accessed in Microsoft Team Manager as follows: On the Tools menu, click Options, and then click the General tab. The state of this setting is stored in the Windows registry, along with the path and name of the last file (the file most recently opened). If this setting is selected, the last file is automatically opened when Microsoft Team Manager starts, provided it is not started using OLE Automation.OLE Automation cannot be used to start Microsoft Team Manager and automatically open the last file, and there is no property or method that will return the path and name of the last file. The Shell function can be used to start Microsoft Team Manager and automatically open the last file, provided that the "Open last file at startup" setting is selected and Microsoft Team Manager is not already running. After the Shell function, the GetObject function can be used to control Microsoft Team Manager with OLE Automation. For example:
REFERENCESFor additional information about using OLE Automation with Microsoft Team Manager, see the file TM1VBA.WRI located in the same folder as the Microsoft Team Manager application. Additional query words: 1.0 1.00 macro
Keywords : kberrmsg kbole kbdta kbdtacode |
Last Reviewed: October 20, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |