Board logo

標題: [發問] VBA 電郵加入預設簽署 [打印本頁]

作者: missbb    時間: 2017-1-23 19:50     標題: VBA 電郵加入預設簽署

[attach]26442[/attach]
請問如何可以在電郵內加入預設的簽署? 因為試了很久也不能處理, 求助大大?
[attach]26443[/attach]

Sub annualsporemailtestonly()

' sent annual sponsorship email and input content to in this vba.

'Column A holds name of the company
'Column B holds sex
'Column C holds name of the person
'Column E holds email addressn (column d is empty for future use)
'Column F holds Yes or No to send
   
        
    Dim xPath As String
    Dim EBody As String
    Dim strSignature As String
        
    xPath = Application.ActiveWorkbook.Path
   
  
EBody = "<b><u>" & "Re : TEST" & "</b></u>" & "<br>" & "<br>" _
    & "How are you" & " <br/>" & "<br>" _
    & "Thank you" & "<br>" & "<br>"

   
   
   
Worksheets("email").Activate

On Error GoTo EndOfSub
    For Each cell In Columns("d").Cells.SpecialCells(2, 2)
        If cell.Text Like "?*@?*.?*" And _
           LCase(Cells(cell.Row, "e").Text) = "yes" Then

            On Error Resume Next
            With CreateObject("Outlook.Application").CreateItem(0)
                .To = cell.Text
                .Subject = "Test"
                .HTMLBody = Replace("Dear " & Cells(cell.Row, "B").Value & " " & Cells(cell.Row, "C") & "," & vbNew & "#" & Cells(cell.Row, "f").Value & "<br>" & "<br>" & EBody, "#", vbNew & vbNew)
                .Attachments.Add (ActiveWorkbook.Path & "\test.pdf")
                    

                .display  'Or use .Display
            End With
            On Error GoTo 0
        End If
    Next

EndOfSub:


End Sub
[/code]




歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)