当不使用对象识别符号时,此属性返回一个 Application 对象,该对象代表 Microsoft Word 应用程序;当使用对象识别符号时,此属性返回一个 Application 对象,该对象代表指定对象的创建者;当对 OLE 自动功能对象应用此属性时,返回该对象的应用程序。
expression.Application
expression 必需。该表达式返回“应用于”列表中的一个对象。
Visual Basic 的 CreateObject 和 GetObject 函数使您可以在 Visual Basic for Applications 工程中访问 OLE 自动功能对象。
本示例使 Microsoft Word 显示滚动条、屏幕提示和状态栏。
With Application
.DisplayScrollBars = True
.DisplayScreenTips = True
.DisplayStatusBar = True
End With
如果正在运行的是 Excel,本示例将显示 Microsoft Excel 启动路径。
If Tasks.Exists(Name:="Microsoft Excel") = True Then
Set myobject = GetObject("", "Excel.Application")
MsgBox myobject.Application.StartupPath
Set myobject = Nothing
End If