Placing a PowerPoint Slide in an Outlook Message : Email Attachment « Outlook « VBA / Excel / Access / Word

VBA / Excel / Access / Word
1. Access
2. Application
3. Data Type
4. Data Type Functions
5. Date Functions
6. Excel
7. File Path
8. Forms
9. Language Basics
10. Math Functions
11. Outlook
12. PowerPoint
13. String Functions
14. Windows API
15. Word
16. XML
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
VBA / Excel / Access / Word » Outlook » Email Attachment 
Placing a PowerPoint Slide in an Outlook Message
 
  Sub Notify_of_New_Presentation()

      Dim myPresentation As Presentation
      Dim strPresentationFilename As String
      Dim strPresentationTitle As String
      Dim strPresentationPresenter As String
      Dim myOutlook As Outlook.Application
      Dim myMessage As Outlook.MailItem
      Const errOutlookNotRunning = 429

      On Error GoTo ErrorHandler

      Set myPresentation = ActivePresentation
      With myPresentation
          strPresentationFilename = .FullName
          strPresentationTitle = _
              .Slides(1).Shapes(1).TextFrame.TextRange.Text
          strPresentationPresenter = _
              .Slides(1).Shapes(2).TextFrame.TextRange.Text
      End With

      Set myOutlook = GetObject("Outlook.Application")
      Set myMessage = myOutlook.CreateItem(ItemType:=olMailItem)
      With myMessage
          .To = "your@your.com"
          .CC = "Presentation Archive"
          .Subject = "Presentation for review: " & strPresentationTitle
          .BodyFormat = olFormatHTML
          .Body = "Please review the following presentation:" & _
              vbCr & vbCr & "Title: " & strPresentationTitle & vbCr & _
              "Presenter: " & strPresentationPresenter & vbCr & vbCr & _
              "The presentation is in the file: " & _
              strPresentationFilename
          .Send
      End With

      myOutlook.Quit


      Set myMessage = Nothing
      Set myOutlook = Nothing
      Exit Sub
  ErrorHandler:
      If Err.Number = errOutlookNotRunning Then
          Set myOutlook = CreateObject("Outlook.Application")
          Err.Clear
          Resume Next
      Else
          MsgBox Err.Number & vbCr & Err.Description, vbOKOnly + _
              Critical, "An Error Has Occurred"
    End If
End Sub

 
Related examples in the same category
1. Adding an Attachment to a Message
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.