CurrentUser 属性

       

返回代表当前登录的用户的 Recipient 对象。

expression.CurrentUser

expression   必选。该表达式返回 NameSpace 对象。

示例

本 Visual Basic for Applications 示例使用 CurrentUser 属性获得当前登录用户的名称,并显示包含该名称的消息框。

Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNameSpace("MAPI")
MsgBox myNameSpace.CurrentUser.Name

如果使用 VBScript,则不必创建 Application 对象。本示例说明如何使用 VBScript 执行相同任务。

Set myNameSpace = Application.GetNameSpace("MAPI")
MsgBox myNameSpace.CurrentUser.Name