尝试创建Outlook实例时,UAC正在阻止此过程。我知道在Windows 7 UAC可以改变,但Windows 8它不能完全删除。这就是我需要管理员权限的原因。以管理员身份运行实例
Try
' Get running outlook instance (if there is)
outlook = GetObject(Nothing, OUTLOOK_CLASS)
Catch ex As Exception
End Try
' No running instance? then create new instance of outlook
If IsNothing(outlook) = True Then
Try
outlook = CreateObject(OUTLOOK_CLASS)
Catch ex As Exception
End Try
End If
' Show error message if outlook is not installed
If IsNothing(outlook) = True Then
MsgBox(String.Format(My.Resources.ErrorEmailUnableToSend, vbCrLf, My.Settings.EmailNHD), MsgBoxStyle.Exclamation, My.Application.Info.Title)
Exit Try
End If
' Create the email message
email = outlook.CreateItem(mailItem)
似乎在这里丢失了一个问题(?) – dummy