ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

¥Îvba µoyahoo GMAIL ªº¹q¤l¶l¥ó¤£¥Î³z¹Loutlook


  1. Option Explicit

  2. Sub SendAsPDF()
  3. '   Uses early binding
  4. '   Requires a reference to the Outlook Object Library
  5.     Dim OutlookApp As Outlook.Application
  6.     Dim MItem As Object
  7.     Dim Recipient As String, Subj As String
  8.     Dim Msg As String, Fname As String
  9.             
  10. '   Message details
  11.     Recipient = "[email protected]"
  12.     Subj = "Sales figures"
  13.     Msg = "Hey boss, here's the PDF file you wanted."
  14.     Msg = Msg & vbNewLine & vbNewLine & "-Frank"
  15.     Fname = Application.DefaultFilePath & "\" & _
  16.       ActiveWorkbook.Name & ".pdf"
  17.    
  18. '   Create the attachment
  19.     ActiveSheet.ExportAsFixedFormat _
  20.         Type:=xlTypePDF, _
  21.         Filename:=Fname
  22.    
  23. '   Create Outlook object
  24.     Set OutlookApp = New Outlook.Application
  25.    
  26. '   Create Mail Item and send it
  27.     Set MItem = OutlookApp.CreateItem(olMailItem)
  28.     With MItem
  29.       .To = Recipient
  30.       .Subject = Subj
  31.       .Body = Msg
  32.       .Attachments.Add Fname
  33.       .Save 'to Drafts folder
  34.       '.Send
  35.     End With
  36.     Set OutlookApp = Nothing

  37. '   Delete the file
  38.     Kill Fname
  39. End Sub
½Æ»s¥N½X

TOP


µù¡G¤W­zµ{¦¡½X¡A»Ý­n¤Þ¥Î¡¨Microsoft Outlook 12.0 Object Library"

TOP

        ÀR«ä¦Û¦b : ¤â¤ß¦V¤U¬O§U¤H¡A¤â¤ß¦V¤W¬O¨D¤H¡F§U¤H§Ö¼Ö¡A¨D¤Hµh­W¡C
ªð¦^¦Cªí ¤W¤@¥DÃD