通过OutLook2002自动发信,每次操作时Outlook都会跳出一个对话框,“A program is trying to automatically send e-mail using a Microsoft on your behalf. Do you want to allow this?”因此每次都要手工点击“yes"才能继续。
如何去掉呢?我找了资料说下面这样写就可以了
Set ol = CreateObject("Outlook.Application")
Set Session = ol.Session
Set AL = ol.Session.AddressLists("Global Address List")
Set AE = AL.AddressEntries(1)
MsgBox AE.Address可执行『Set Session = ol.Session 』这句通不过吖。
怎么办?

解决方案 »

  1.   

    你下面的代码好像没有用导Session变量啊
      

  2.   

    msgbox ol.Session.AddressLists.Item(1).AddressEntries(1)
      

  3.   

    试下下面的函数
    Function CreateMail(astrRecip As Variant,strSubject As String,              strMessage As String, Optional astrAttachments As Variant) As Boolean
       Dim olApp                 As Outlook.Application
       Dim objNewMail            As Outlook.MailItem
       Dim varRecip              As Variant
       Dim varAttach             As Variant
       Dim blnResolveSuccess     As Boolean
       On Error GoTo CreateMail_Err
       Set olApp = New Outlook.Application
       Set objNewMail = olApp.CreateItem(olMailItem)
       With objNewMail
          For Each varRecip In astrRecip
             .Recipients.Add varRecip
          Next varRecip
          blnResolveSuccess = .Recipients.ResolveAll
          For Each varAttach In astrAttachments
              .Attachments.Add varAttach
          Next varAttach
          .Subject = strSubject
          .Body = strMessage
          If blnResolveSuccess Then
              .Send
          Else
             MsgBox "Unable to resolve all recipients. Please check the names."
             .Display
          End If
       End With
       CreateMail = True
    CreateMail_End:
       Exit Function
    CreateMail_Err:
       CreateMail = False
       Resume CreateMail_End
    End Function
      

  4.   

    给你的程序加上数字证书,并在Outlook导入该数字证书,表示信任拥有该数字证书的程序,以后就不会弹出来了。制作数字证书可用Office带的本地数字签名工具 SelfCert.exe
      

  5.   

    怎么找不到SelfCert.exe
    救命啊!