0
私の主な問題getexchangeuserオブジェクトにactivecellvalueをスローして、特定のユーザのスーパバイザを取得するにはどうすればよいですか??私は以下のコードを試していますが、その方法はわかりませんが、エラー91のオブジェクト変数が設定されていません。Excel VBA Getexchangeuser.Getexchangeusermanagerクエリ
Set Usersupervisor = myExchangeuser.GetExchangeUser(ActiveCell.Cells(1, 10)).GetExchangeUserManager.Alias
私は自分の上司が必要な場合は、作品ものの、このコード行。
.To = outlookmail.Session.CurrentUser.AddressEntry.GetExchangeUser.GetExchangeUserManager.Alias
は基本的に私は、Outlookで解決しない受信者のエイリアスまたはユーザー名を持っています。特定のエイリアスのマネージャ情報を参照して、.Toフィールドに使用する必要があります。それも可能ですか?ガイドのほとんどは私の要求に合っていません。
Dim outlookapp As Outlook.Application
Dim outlookmail As Outlook.MailItem
Dim myusername As String
Dim myExchangeuser As Outlook.ExchangeUser
Dim mngname As Outlook.AddressEntry
Dim mysupervisor As String
myusername = Environ("Username")
mysupervisor = CStr(myExchangeuser.GetExchangeUser(ActiveCell.Cells(1, 10)).GetExchangeUserManager.Alias)
Set outlookapp = New Outlook.Application
Set outlookmail = outlookapp.CreateItemFromTemplate("C:\Users\" & myusername & "\AppData\Roaming\Microsoft\Templates\x.oft")
With outlookmail
'.To = ActiveCell.Cells(1, 10)
'.To = outlookmail.Session.CurrentUser.AddressEntry.GetExchangeUser.GetExchangeUserManager.Alias
.To = mysupervisor
End With
ActiveCell.Cells(1, 13) = "Yes"
ActiveCell.Cells(1, 14) = DateTime.Now
outlookmail.Display