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

¬°¦ó°õ¦æexcel vba¤§«á«H¥ó¤´°±¦boutlook±H¥ó§¨©O¡H

¬°¦ó°õ¦æexcel vba¤§«á«H¥ó¤´°±¦boutlook±H¥ó§¨©O¡H

¦U¦ì¤j¤j¦n¡G
       
        ¤p§Ì§Q¥ÎEXCEL VBA¤è¦¡E-MAIL
¤å¥ó¸ê®Æ¨ÃÀHªþÀɮסC¥i¬O«oµo²{°õ¦æ¤§«á¡F
¸ÓE-MAIL«H¥ó¸ê®Æ¤´°±¯d¦bOUTLOOK±H¥ó§¨¤º¡C
«D­n¥h¶}±ÒOUTLOOK¦A«ö°õ¦æ±H¥óªº°Ê§@¤~·|
±N¦¹«H¥ó±H°e¥X¥h©O¡H

'outlook 2002ª©¥»
'excel 2002ª©¥»

Sub SendWithAtt()

    '¤Þ¥ÎMicrosoft outlook object library

    Dim olApp As Outlook.Application
    Dim olMail As MailItem
    Dim CurrFile As String

    Set olApp = New Outlook.Application
    Set olMail = olApp.CreateItem(olMailItem)


    CurrFile = "d:\temp\test.txt"

    With olMail
        .To = "[email protected]"
        .Subject = "These one files"
        .Body = "´ú¸Õ«H¥ó"
        .Attachments.Add CurrFile
        '.Display
        .Send
    End With

    Set olMail = Nothing
    Set olApp = Nothing

End Sub

·PÁ¦U¦ì¤j¤j¡C

¦^´_ 1# dechiuan999

¥i¯à¬O¥d¦bOutLook ¦w¥þ©Ê,¸Õ¸Õ CDO±H«H¤è¦¡

¬ÛÃöºô­¶:
http://www.pro-soho.com/Blog/article.asp?id=295
http://aqr199xx.pixnet.net/blog/post/23750101

TOP

·PÁ¤j¤j¡C

¤p§Ì¥ý¦¬¤U
¸Õ¸Õ¡C
·P®¦¡I

TOP

ÁÂÁ¤j¤j¡C

¤p§Ì¤Þ¥Î¤U»yªk
¤w¥i¹F¦¨e-mail¤F¡C

'Microsoft CDO for Windows 2000 Library
Private Sub CommandButton1_Click()   
   
    Dim mPath As String
    Dim mFilename As String, mFile$
    Dim mStr$
    Dim myMail As Object   
   
    mPath = "D:\temp\"   
    mFilename = TextBox1.Text   
    If Len(mFilename) = 0 Then        
        MsgBox "½Ð¥ý¿é¤J«È¤á½s¸¹"
        Exit Sub        
    End If
   
    mFile = mPath & mFilename & ".pdf"   
    mStr = Dir(mFile)
   
    If Len(mStr) = 0 Then        
        MsgBox "¿é¤JÀɦW¤£¦s¦b" & vbCrLf & vbCrLf & "½Ð­«·s¿é¤JÀɦW"
        Exit Sub        
    End If
   
   Set myMail = CreateObject("CDO.Message")   
   
   myMail.BodyPart.Charset = "big5"   
   myMail.Subject = "KUOZUI MOTORS LTD" & mFilename
   myMail.Subject = "CUSTOMER CORP" & mFilename   
   myMail.From = "[email protected]"
   myMail.To = "[email protected]"   
   myMail.CC = "[email protected]"   
   myMail.TextBody = "AUTO PARTS"
   myMail.AddAttachment (mFile)
   myMail.Send   
   
   Set myMail = Nothing   
   TextBox1.Text = ""
   TextBox1.SetFocus      
End Sub

TOP

        ÀR«ä¦Û¦b : ¦³¦h¤Ö¤O¶q´N°µ¦h¤Ö¨Æ¡A¤£­n¤ß¦sµ¥«Ý¡Aµ¥«Ý¤~·|¸¨ªÅ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD