XL98: UserControl Property Code Example Doesn't Work
ID: Q183472
|
The information in this article applies to:
-
Microsoft Excel 98 Macintosh Edition
SYMPTOMS
In Visual Basic for Applications Help in Microsoft Excel 98 Macintosh
Edition, the example code that is provided for the UserControl property
does not work.
CAUSE
The example code for the UserControl property assumes that the UserControl
property applies to Workbook objects; however, the property applies
only to the Application object.
WORKAROUND
To work around this behavior, use the examples in the "More Information"
section of this article when you want to see an example of the UserControl
property.
MORE INFORMATION
In Microsoft Excel 98 Macintosh Edition, you can use the UserControl
property to determine whether an instance of Microsoft Excel that is opened
through Automation will continue to run when its object is released. By
default, the UserControl property has a value of False.
The following examples use the UserControl property in a macro in Visual
Basic or Visual Basic for Applications.
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
the Microsoft fee-based consulting line at (800) 936-5200. For more
information about the support options available from Microsoft, please see
the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/overview/overview.asp Example 1: Leave UserControl Set to False
To use this example, follow these steps:
- In Microsoft Word 98 Macintosh Edition, point to Macro on the Tools menu
and click Visual Basic Editor. Or, press OPTION+F11.
- On the Insert menu, click Module.
- Enter the following code:
Sub UserControlStaysFalse()
Set xlApp = CreateObject("Excel.Application.8")
xlApp.Visible = True
MsgBox "This is Microsoft Excel 98, build " & xlApp.Build
xlApp.Quit
Set xlApp = Nothing
End Sub
- On the Tools menu, click Macros. In the list of macros, click
UserControlStaysFalse, and then click Run.
The macro runs and displays a message box with the message "This is
Microsoft Excel 98, build <xxxx>." When the macro is finished running,
Microsoft Excel is automatically closed.
Example 2: Set UserControl Set to True
To use this example, follow these steps:
- In Microsoft Word 98 Macintosh Edition, point to Macro on the Tools menu
and click Visual Basic Editor. Or, press OPTION+F11.
- On the Insert menu, click Module.
- Enter the following code:
Sub UserControlSetToTrue()
Set xlApp = CreateObject("Excel.Application.8")
xlApp.Visible = True
MsgBox "This is Microsoft Excel 98, build " & xlApp.Build
xlApp.UserControl = True
Set xlApp = Nothing
End Sub
- On the Tools menu, click Macros. In the list of macros, click
UserControlSetToTrue, and then click Run.
The macro runs and displays a message box with the message "This is
Microsoft Excel 98, build <xxxx>." When the macro is finished running, the
instance of Microsoft Excel continues to run even though the xlApp object
has been released.
Notes About Using the UserControl Property
Additional query words:
XL97 8.0 vbe
Keywords : kbprg xlvbahowto xlvbainfo xlhelp
Version : MACINTOSH:98
Platform : MACINTOSH
Issue type : kbprb
|