VBA/Excel/Access/Word/Outlook/InternetExplorer

Материал из VB Эксперт
Перейти к: навигация, поиск

Show Mail item in IE

 
Public Sub ShowIE()
  Dim omail As Outlook.MailItem
  Dim colSelection As Outlook.Selection
  
  Set colSelection = Application.ActiveExplorer.Selection
  
  If colSelection.Count = 1 Then
    Set omail = colSelection.Item(1)
    Call ViewInIE(omail)
  End If
  Set omail = Nothing
  Set colSelection = Nothing
End Sub
Private Sub ViewInIE(objMail As Outlook.MailItem)
  Dim strURL As String
  Dim strPath As String
  
  strPath = "c:\" & objMail.Subject & ".htm"
  objMail.SaveAs strPath, olHTML
  
  strURL = "File://" & strPath
  
  Set m_objIE = New InternetExplorer
  
  m_objIE.Visible = True
  m_objIE.Navigate strURL
End Sub