2017-05-04 2 views
1

Outlook 이메일에 Excel 데이터를 추가하려고합니다.이메일 끝 부분에 서명 추가

다음은 Outlook 전자 메일 편집기의 출력 그림입니다. 내가 추가하려고하는 img는 Excel 내용 다음에 끝에 추가해야합니다. This is a illustration of how the output in a outlook email editor. The img I'm trying to add should be add at the end, after the excel content

각주의 이미지를 추가하는 데 여러 가지 방법을 시도했습니다.

<img> 태그를 HTML 첨부 파일로 첨부하려고 시도했지만 간격없이 첨부됩니다.

처음
.Attachments.Add "C:\Users\Sumit Jain\Pictures\11\city.jpg", olByValue, 0 

.HTMLBody = .HTMLBody & "<img src='cid:city.jpg'><br>" 

가 그럼 난 Outlook에서 기본 서명을 만드는 노력이 두 라인을 사용했습니다.

코드

.HTMLBody = "<HTML><body><body></HTML>" & .HTMLBody 

상단에 Outlook의 기본 서명을 추가 한 후 엑셀의 콘텐츠 후. 페이지

참조 내가 아래

Link에서 논리를 사용 당신은 이름에 Mysig.htm을 추가해야합니다 .... 코드

Private Sub CommandButton9_Click() 
On Error GoTo ERRORMSG 
Dim OutApp As Object 
Dim OutMail As Object 
Dim olInsp As Object 
Dim wdDoc As Object 
Dim oRng As Object 

Set otlApp = CreateObject("Outlook.Application") 
Set olMail = otlApp.CreateItem(olMailItem) 
Set Doc = olMail.GetInspector.WordEditor 
Set mainWB = ActiveWorkbook 

mainWB.Sheets("Mail").Range("m8").Value = ComboBox4.Value 
mainWB.Sheets("Mail").Range("n8").Value = TextBox40.Value 
mainWB.Sheets("Mail").Range("q8").Value = ComboBox5.Value 
mainWB.Sheets("Mail").Range("r8").Value = ComboBox6.Value 
mainWB.Sheets("Mail").Range("s8").Value = ComboBox7.Value 
mainWB.Sheets("Mail").Range("t8").Value = TextBox44.Value 

On Error Resume Next 
Set OutApp = GetObject(, "Outlook.Application") 
If Err <> 0 Then Set OutApp = CreateObject("Outlook.Application") 
On Error GoTo 0 

Set OutMail = OutApp.CreateItem(0) 
With OutMail 
    .To = mainWB.Sheets("Email").Range("A3").Value 
    .cc = mainWB.Sheets("Mail").Range("L12").Value 
    .Subject = mainWB.Sheets("Mail").Range("O15").Value 
    Set olInsp = .GetInspector 
    Set wdDoc = olInsp.WordEditor 
    Set oRng = wdDoc.Range 

    'force html format 
    .HTMLBody = "<HTML><body><body></HTML>" & .HTMLBody 
    .Display 

    '--- start with 6 CrLf's, so we can place each table 
    ' above all but the last used... 
    oRng.InsertAfter vbCrLf & vbCrLf 

    '--- now reselect the entire document, collapse our cursor to the end 
    ' and back up one character (so that the table inserts before the SIXTH CrLf) 
    Set oRng = wdDoc.Range 
    oRng.collapse 0 
    oRng.Move 1, -1 
    Range("K3:T10").Select 
    Selection.Copy 
    oRng.Paste 

    '--- finally move the cursor all the way to the end and paste the 
    ' second table BELOW the SIXTH CrLf 
    Set oRng = wdDoc.Range 
    oRng.collapse 0 
    Range("K38:T46").Select 
    Selection.Copy 
    oRng.Paste 
End With 
Exit Sub 
End Sub 
+0

'.Attachments.Add'가되어야합니다. C : \ Use rs \ Sumit Jain \ Pictures \ 11 \ city.jpg ", olByValue, 0' .HTMLBody =" " – 0m3r

+0

위의 내용을 시도해보십시오. 이렇게하면 시작 부분에 그림이 추가 된 다음 Excel이 추가됩니다. 반면에 다른 방법으로 얻으 려하고있는 반면 –

+0

예제 이미지를 원하는 방식으로 만들 수 있습니까? – 0m3r

답변

0

당신의 코드에서 다음과 같은 시도를

입니다 귀하의 서명 중

SigString = Environ("appdata") & "\Microsoft\Signatures\" & UOutLookSign & ".htm" 

If Dir(SigString) <> "" Then 

    Signature = GetBoiler(SigString) 

Else 

    Signature = "" 

End If 
+0

소스는 완전한 정보를 제공합니다. http://www.rondebruin.nl/win/s1/outlook/signature.htm – niton

관련 문제