在VBscript中拆分GetNameSpace(“MAPI”)的输出

在VBscript中拆分GetNameSpace(“MAPI”)的输出,vbscript,Vbscript,我正在学习VBscript以帮助在outlook中创建用户表单。使用此约会表单,我试图创建一封使用当前用户姓名签名的预格式化电子邮件。我只希望输出是当前用户的名字。它当前正在返回全名 如何拆分用户名或仅获取用户名 提前谢谢 Sub commandbutton1_click() Set MyApp = CreateObject("Outlook.Application") Set MyItem = MyApp.CreateItem(0) 'olMailItem set prop = item.us

我正在学习VBscript以帮助在outlook中创建用户表单。使用此约会表单,我试图创建一封使用当前用户姓名签名的预格式化电子邮件。我只希望输出是当前用户的名字。它当前正在返回全名

如何拆分用户名或仅获取用户名

提前谢谢

Sub commandbutton1_click()
Set MyApp = CreateObject("Outlook.Application")
Set MyItem = MyApp.CreateItem(0) 'olMailItem
set prop = item.userproperties.find("Mobile")
set currentuser = application.getNameSpace("MAPI").CurrentUser
Set prop1 = item.userProperties.find("Subject")
Set prop2 = item.userProperties.find("Location")
Set prop3 = item.userProperties.find("DateStart")

dteThen = dateAdd("h", -1, Now())

With MyItem
                .To = prop & "@etxt.co.nz"
                .Subject = ""
                .Body = "Hi " & Subject & vbCrlf & vbCrlf & "This is a reminder about your meeting at " & Location & vbCrlf & vbCrlf & "Thanks" & currentUser
                .DeferredDeliveryTime = DateStart + dteThen
End With
MyItem.Display
end sub
相当简单

Sub commandbutton1_click()
Set MyApp = CreateObject("Outlook.Application")
Set MyItem = MyApp.CreateItem(0) 'olMailItem
set prop = item.userproperties.find("Mobile")
set currentuser = application.getNameSpace("MAPI").CurrentUser
Set prop1 = item.userProperties.find("Subject")
Set prop2 = item.userProperties.find("Location")
Set prop3 = item.userProperties.find("DateStart")
arrUserName = Split(currentUser, ",") 'Split the name using "," 
strName = Trim(arrUserName(1))   'Remove any space

dteThen = dateAdd("h", -1, Now())

With MyItem
                .To = prop & "@etxt.co.nz"
                .Subject = ""

                .Body = "Hi " & Subject & vbCrlf & vbCrlf & "This is a reminder about your meeting at " & Location & vbCrlf & vbCrlf & "Thanks," & vbcrLF & strName 'use of strName
                .DeferredDeliveryTime = DateStart + dteThen
End With
MyItem.Display
end sub

请显示名称显示方式的示例。。就像您在currentuser变量中得到的值一样感谢您的回复。姓名显示如下:(姓),(名)即史密斯,约翰。此时,这会生成一封电子邮件,上面写着“谢谢史密斯,约翰”。我只需要写“谢谢约翰”。我不知道如何让分割函数工作。