메인 컨텐츠로 가기

Excel에서 이메일을 보낼 때 Outlook 서명을 삽입하는 방법은 무엇입니까?

Excel에서 직접 전자 메일을 보내려는 경우 전자 메일에 기본 Outlook 서명을 어떻게 추가할 수 있습니까? 이 문서에서는 Excel에서 전자 메일을 보낼 때 Outlook 서명을 추가하는 데 도움이 되는 두 가지 방법을 제공합니다.

Excel VBA로 보낼 때 Outlook 전자 메일에 서명 삽입
놀라운 도구를 사용하여 Excel에서 전자 메일을 보낼 때 Outlook 서명을 쉽게 삽입

Excel 메일 링에 대한 추가 자습서 ...


Excel VBA로 보낼 때 Outlook 전자 메일에 서명 삽입

예를 들어, Excel에서 이러한 모든 주소로 이메일을 보내고 이메일에 기본 Outlook 서명을 추가하기 위해 워크시트에 이메일 주소 목록이 있습니다. 이를 달성하려면 아래 VBA 코드를 적용하십시오.

1. 이메일을 보내려는 이메일 주소 목록이 포함 된 워크 시트를 연 다음 다른 + F11 열쇠.

2. 오프닝에서 응용 프로그램 용 Microsoft Visual Basic 창을 클릭합니다 끼워 넣다 > 기준 치수, 그런 다음 아래를 복사하십시오. VBA 2 모듈 코드 창으로.

3. 이제 교체해야합니다. .몸 라인 인 VBA 2 코드와 함께 VBA 1. 그 후, 라인을 이동 .디스플레이 라인 아래 xMailOut 사용.

VBA 1: Excel에서 Outlook 기본 서명을 사용하여 이메일을 보내는 템플릿

.HTMLBody = "This is a test email sending in Excel" & "<br>" & .HTMLBody

VBA 2 : Excel의 셀에 지정된 전자 메일 주소로 전자 메일 보내기

Sub SendEmailToAddressInCells()
    Dim xRg As Range
    Dim xRgEach As Range
    Dim xRgVal As String
    Dim xAddress As String
    Dim xOutApp As Outlook.Application
    Dim xMailOut As Outlook.MailItem
    On Error Resume Next
    xAddress = ActiveWindow.RangeSelection.Address
    Set xRg = Application.InputBox("Please select email address range", "KuTools For Excel", xAddress, , , , , 8)
    If xRg Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    Set xOutApp = CreateObject("Outlook.Application")
    Set xRg = xRg.SpecialCells(xlCellTypeConstants, xlTextValues)
    For Each xRgEach In xRg
        xRgVal = xRgEach.Value
        If xRgVal Like "?*@?*.?*" Then
            Set xMailOut = xOutApp.CreateItem(olMailItem)
            With xMailOut
                .To = xRgVal
                .Subject = "Test"
                .Body = "Dear " _
                      & vbNewLine & vbNewLine & _
                        "This is a test email " & _
                        "sending in Excel"
                .Display
                '.Send
            End With
        End If
    Next
    Set xMailOut = Nothing
    Set xOutApp = Nothing
    Application.ScreenUpdating = True
End Sub

다음 스크린 샷은 VBA 코드를 변경 한 후 차이점을 쉽게 찾을 수 있도록 도와줍니다.

4. 누르세요 F5 코드를 실행하는 키입니다. 그 다음에 Excel 용 Kutools 선택 상자가 나타나면 이메일을 보낼 이메일 주소를 선택한 다음 좋아요.

그러면 이메일이 생성됩니다. 이메일 본문 끝에 Outlook 기본 서명이 추가된 것을 볼 수 있습니다.

팁 :

  • 1. 필요에 따라 VBA 코드 1에서 이메일 본문을 변경할 수 있습니다.
  • 2. 코드 실행 후 사용자 정의 유형이 정의되지 않았다는 오류 대화 상자가 나타나면이 대화 상자를 닫고 클릭하십시오. 도구 > 참고자료 FBI 증오 범죄 보고서 응용 프로그램 용 Microsoft Visual Basic 창문. 오프닝에서 참조 – VBAProject 창, 확인 Microsoft Outlook 개체 라이브러리 상자를 클릭하고 좋아요. 그런 다음 코드를 다시 실행하십시오.

놀라운 도구를 사용하여 Excel에서 전자 메일을 보낼 때 Outlook 서명을 쉽게 삽입

VBA의 초보자라면 여기에서 이메일 보내기 ~의 유용성 Excel 용 Kutools 당신을 위해. 이 기능을 사용하면 Excel의 특정 필드를 기반으로 이메일을 쉽게 보내고 여기에 Outlook 서명을 추가 할 수 있습니다. 다음과 같이하십시오.

신청하기 전에 Excel 용 Kutools, 제발 먼저 다운로드하여 설치하십시오..

먼저 이메일을 보낼 다른 필드로 메일 링리스트를 만들어야합니다.

필요에 따라 수동으로 메일 링리스트를 생성하거나 메일 링리스트 생성 기능을 적용하여 신속하게 완료 할 수 있습니다.

1. 클릭 쿠툴즈 플러스 > 메일 링리스트를 만듭니다.

2. 에서 메일 링리스트 생성 대화 상자에서 필요한 필드를 지정하고 목록을 출력 할 위치를 선택한 다음 OK 버튼을 클릭합니다.

3. 이제 메일 링리스트 샘플이 생성됩니다. 샘플 목록이므로 필요한 특정 내용으로 필드를 변경해야합니다. (여러 행 허용)

4. 그 후 전체 목록 (헤더 포함)을 선택하고 쿠툴즈 플러스 > 이메일을 보냅니다.

5. 에서 이메일 보내기 대화 상자 :

  • 5.1) 선택한 메일 링 목록의 항목은 해당 필드에 자동으로 배치됩니다.
  • 5.2) 이메일 본문을 완성하십시오.
  • 5.3) 모두 확인 Outlook을 통해 이메일 보내기Outlook의 서명 설정 사용 상자;
  • 5.4) 클릭 전송 단추. 스크린 샷보기 :

이제 이메일이 전송됩니다. 그리고 기본 Outlook 서명이 이메일 본문 끝에 추가됩니다.

  이 유틸리티의 무료 평가판 (30 일)을 받으려면 그것을 다운로드하려면 클릭하십시오을 클릭 한 다음 위 단계에 따라 작업 적용으로 이동합니다.


관련 기사 :

Excel의 셀에 지정된 이메일 주소로 이메일 보내기
전자 메일 주소 목록이 있고 Excel에서 직접 이러한 전자 메일 주소로 전자 메일 메시지를 대량으로 보내려고한다고 가정합니다. 그것을 달성하는 방법? 이 기사에서는 Excel의 셀에 지정된 여러 이메일 주소로 이메일을 보내는 방법을 보여줍니다.

지정된 범위를 복사하여 Excel의 이메일 본문에 붙여 넣은 이메일 보내기
대부분의 경우 Excel 워크 시트에 지정된 범위의 내용이 전자 메일 통신에 유용 할 수 있습니다. 이 기사에서는 Excel에서 직접 이메일 본문에 지정된 범위를 붙여 넣은 이메일을 보내는 방법을 소개합니다.

Excel에 첨부 된 여러 첨부 파일이있는 전자 메일 보내기
이 기사에서는 Excel에 여러 첨부 파일이 첨부 된 Outlook을 통해 전자 메일을 보내는 방법에 대해 설명합니다.

Excel에서 기한이 충족되면 전자 메일 보내기
예를 들어 C 열의 기한이 7 일 이하인 경우 (현재 날짜는 2017/9/13) A 열의 지정된 수신자에게 B 열에 지정된 내용과 함께 이메일 알림을 보냅니다. 방법 그것을 이루다? 이 기사에서는 VBA 방법을 자세히 설명합니다.

Excel의 셀 값에 따라 자동으로 이메일 보내기
Excel의 지정된 셀 값을 기반으로 Outlook을 통해 특정 수신자에게 이메일을 보내려고한다고 가정합니다. 예를 들어 워크 시트의 D7 셀 값이 200보다 크면 전자 메일이 자동으로 생성됩니다. 이 기사에서는이 문제를 빠르게 해결할 수있는 VBA 방법을 소개합니다.

Excel 메일 링에 대한 추가 자습서 ...

최고의 사무 생산성 도구

🤖 Kutools AI 보좌관: 다음을 기반으로 데이터 분석을 혁신합니다. 지능형 실행   |  코드 생성  |  사용자 정의 수식 만들기  |  데이터 분석 및 차트 생성  |  Kutools 기능 호출...
인기 기능: 중복 항목 찾기, 강조 표시 또는 식별   |  빈 행 삭제   |  데이터 손실 없이 열이나 셀 결합   |   수식없이 반올림 ...
슈퍼 조회: 다중 기준 VLookup    다중 값 VLookup  |   여러 시트에 걸친 VLookup   |   퍼지 조회 ....
고급 드롭다운 목록: 드롭다운 목록을 빠르게 생성   |  종속 드롭다운 목록   |  다중 선택 드롭 다운 목록 ....
열 관리자: 특정 개수의 열 추가  |  열 이동  |  Toggle 숨겨진 열의 가시성 상태  |  범위 및 열 비교 ...
특색 지어진 특징: 그리드 포커스   |  디자인보기   |   큰 수식 바    통합 문서 및 시트 관리자   |  리소스 라이브러리 (자동 텍스트)   |  날짜 선택기   |  워크 시트 결합   |  셀 암호화/해독    목록으로 이메일 보내기   |  슈퍼 필터   |   특수 필터 (굵게/기울임꼴/취소선 필터링...) ...
상위 15개 도구 세트12 본문 도구 (텍스트 추가, 문자 제거,...)   |   50+ 거래차트 유형 (Gantt 차트,...)   |   40+ 실용 방식 (생일을 기준으로 나이 계산,...)   |   19 삽입 도구 (QR 코드 삽입, 경로에서 그림 삽입,...)   |   12 매출 상승 도구 (숫자를 단어로, 환율,...)   |   7 병합 및 분할 도구 (고급 결합 행, 셀 분할,...)   |   ... 그리고 더

Excel용 Kutools로 Excel 기술을 강화하고 이전과는 전혀 다른 효율성을 경험해 보세요. Excel용 Kutools는 생산성을 높이고 시간을 절약하기 위해 300개 이상의 고급 기능을 제공합니다.  가장 필요한 기능을 얻으려면 여기를 클릭하십시오...

상품 설명


Office Tab은 Office에 탭 인터페이스를 제공하여 작업을 훨씬 쉽게 만듭니다.

  • Word, Excel, PowerPoint에서 탭 편집 및 읽기 사용, Publisher, Access, Visio 및 Project.
  • 새 창이 아닌 동일한 창의 새 탭에서 여러 문서를 열고 만듭니다.
  • 생산성을 50% 높이고 매일 수백 번의 마우스 클릭을 줄입니다!
Comments (31)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Greetings,

How do i add signature in Email body?

Sub outlook165050()
'
' Send 165050 mail
'
Dim xMailBody As String


'
'Application.Dialogs(xlDialogSendMail).Show
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)



With OutMail
.To = " ; ; "
.CC = " ; ; "
.BCC = ""
.Subject = "165050 Swap VM Movements " & Date
.Body = "Todays VM for 165050 is $0"


.Display
'.Send
End With
End Sub
This comment was minimized by the moderator on the site
Hi Raaj Mehta,

You VBA code has been modified. Please give it a try.

Sub outlook165050()
'
' Send 165050 mail
'
Dim xMailBody As String

'
'Application.Dialogs(xlDialogSendMail).Show
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

With OutMail
.Display
.To = " ;  ; "
.CC = " ;  ; "
.BCC = ""
.Subject = "165050 Swap VM Movements " & Date
.HTMLBody = "Todays VM for 165050 is $0" & "<br>" & .HTMLBody

'.Send
End With
End Sub
This comment was minimized by the moderator on the site
Hello, I am trying to fix my VBA Code. I would like to include one of my outlook signatures with a logo. Is this possible, and where do I put the code that I am currently using? Any assistance would be great.

Sub EmailAspdf()

Dim EApp As Object
Set EApp = CreateObject("Outlook.Application")

Dim EItem As Object
Set EItem = EApp.CreateItem(0)

Dim invno As Long
Dim custname As String
Dim amt As Currency
Dim dt_issue As Date
Dim term As Byte
Dim nextrec As Range
Dim path As String
Dim fname As String

invno = Range("I4")
custname = Range("A11")
amt = Range("I42")
dt_issue = Range("I6")
term = Range("I7")
path = "mypath"
fname = invno & " - " & custname

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, IgnorePrintAreas:=False, Filename:=path & fname

Set nextrec = Sheet3.Range("A1048576").End(xlUp).Offset(1, 0)

nextrec = invno
nextrec.Offset(0, 1) = custname
nextrec.Offset(0, 2) = amt
nextrec.Offset(0, 3) = dt_issue
nextrec.Offset(0, 4) = dt_issue + term
nextrec.Offset(0, 8) = Now

Sheet3.Hyperlinks.Add anchor:=nextrec.Offset(0, 6), Address:=path & fname & ".pdf"

With EItem

.To = Range("A17")

.Subject = Range("A11") & " " & "Invoice No: " & Range("I4") & " " & "for California Advocates"

.body = "Hello " & Range("A11") & "," & vbNewLine & vbNewLine _
& "Please see the attached invoice for " & Range("A11") & "." & vbNewLine & vbNewLine _
& "If you have any questions, please do not hesitate to contact me." & vbNewLine & vbNewLine _
& "Best," & vbNewLine _
& "Mynamehere" & vbNewLine

.Attachments.Add (path & fname & ".pdf")

.Display

End With
Exit Sub



End Sub
This comment was minimized by the moderator on the site
Hi RoseAnne,

You can manually add the logo to your signature in advance before applying the VBA code. The code needs to be put in the Module code window (press the Alt + F11 to open the Visual Basic Editor, click Insert > Module)
This comment was minimized by the moderator on the site
Oi Cristal, a minha macro perde a configuração da assinatura do e-mail, com imagens e formatação original. Como consigo resolver?

Sub Geraremail()

Dim OLapp As Outlook.Application
Dim janela As Outlook.MailItem

Set OLapp = New Outlook.Application
Set janela = OLapp.CreateItem(olMailItem)

Arquivo01 = "Mapa AN"
Anexo01 = ThisWorkbook.Path & "\" & Arquivo01 & ".xlsm"


With janela
ActiveWorkbook.Save
.Display
.To = Sheets("Base").Range("A2").Value
.CC = Sheets("Base").Range("A5").Value
.Subject = "Mapa - Acrilo " & Format(Date, "dd.mm.yy")
assinatura = .Body
.Body = "Prezados/as," & Chr(10) & Chr(10) & "Segue anexo o mapa de Acrilonitrila considerando as vendas previstas no S&OP." & Chr(10) & Chr(10) & assinatura
.Attachments.Add Anexo01
End With

End Sub
This comment was minimized by the moderator on the site
Com a mudança abaixo, consegui ajustar. Porém a letra do corpo da mensagem fica em Times New Roman. Gostaria de usar Calibri, como posso alterar o código?

Sub Geraremail()

Dim OLapp As Outlook.Application
Dim janela As Outlook.MailItem

Set OLapp = New Outlook.Application
Set janela = OLapp.CreateItem(olMailItem)

Arquivo01 = "Mapa AN"
Anexo01 = ThisWorkbook.Path & "\" & Arquivo01 & ".xlsm"


With janela
ActiveWorkbook.Save
.Display
.To = Sheets("Base").Range("A2").Value
.CC = Sheets("Base").Range("A5").Value
.Subject = "Mapa - Acrilo " & Format(Date, "dd.mm.yy")
assinatura = .Body
.HTMLBody = "Prezados/as," & Chr(10) & Chr(10) & "Segue anexo o mapa de Acrilonitrila considerando as vendas previstas no S&OP." & "<br>" & .HTMLBody
.Attachments.Add Anexo01
End With

End Sub
This comment was minimized by the moderator on the site
Hi Milla,
The following VBA code can help you change the font of email body to Calibri, please give it a try. Thank you.
Before running the code, you need to click Tools > Reference in the Microsoft Visual Basic for Applications window, and then check the Microsoft Word Object Library checkbox in the References - VBAProject dialog box as the attached file shown below.
Sub Geraremail()
Dim OLapp As Outlook.Application
Dim janela As Outlook.MailItem
Dim xDoc As Document 'Click Tools > Reference to enable the Microsoft Word Object Library
On Error Resume Next
Set OLapp = New Outlook.Application
Set janela = OLapp.CreateItem(olMailItem)
Arquivo01 = "Mapa AN"
Anexo01 = ThisWorkbook.Path & "\" & Arquivo01 & ".xlsm"
With janela
  ActiveWorkbook.Save
  .Display
  .To = Sheets("Base").Range("A2").Value
  .CC = Sheets("Base").Range("A5").Value
  .Subject = "Mapa - Acrilo " & Format(Date, "dd.mm.yy")
   assinatura = .Body
  .HTMLBody = "Prezados/as," & Chr(10) & Chr(10) & "Segue anexo o mapa de Acrilonitrila considerando as vendas previstas no S&OP." & "<br>" & .HTMLBody
  .Attachments.Add Anexo01
End With
Set xDoc = janela.GetInspector.WordEditor
xDoc.Content.Font.Name = "Calibri"
End Sub
This comment was minimized by the moderator on the site
Hi Milla,
The following VBA code can help you change the font of email body to Calibri, please give it a try. Thank you.
Before running the code, you need to click Tools > Reference in the Microsoft Visual Basic for Applications window, and then check the Microsoft Word Object Library checkbox in the References - VBAProject dialog box as the screenshot shown below.
[img]I:\工作\周雪明\2022年工作\6月份\文章评论截图\3.png[/img]
Sub Geraremail()
Dim OLapp As Outlook.Application
Dim janela As Outlook.MailItem
Dim xDoc As Document 'Click Tools > Reference to enable the Microsoft Word Object Library
On Error Resume Next
Set OLapp = New Outlook.Application
Set janela = OLapp.CreateItem(olMailItem)
Arquivo01 = "Mapa AN"
Anexo01 = ThisWorkbook.Path & "\" & Arquivo01 & ".xlsm"
With janela
  ActiveWorkbook.Save
  .Display
  .To = Sheets("Base").Range("A2").Value
  .CC = Sheets("Base").Range("A5").Value
  .Subject = "Mapa - Acrilo " & Format(Date, "dd.mm.yy")
   assinatura = .Body
  .HTMLBody = "Prezados/as," & Chr(10) & Chr(10) & "Segue anexo o mapa de Acrilonitrila considerando as vendas previstas no S&OP." & "<br>" & .HTMLBody
  .Attachments.Add Anexo01
End With
Set xDoc = janela.GetInspector.WordEditor
xDoc.Content.Font.Name = "Calibri"
End Sub
This comment was minimized by the moderator on the site
I'm trying to send individual sheets from excel to different emails, but it will only attach the workbook itself.  Also, need to be able to add my signature line in.  Any help?Sub AST_Email_From_Excel()

Dim emailApplication As Object
Dim emailItem As Object

Set emailApplication = CreateObject("Outlook.Application")
Set emailItem = emailApplication.CreateItem(0)

' Now we build the email.

emailItem.to = Range("e2").Value

emailItem.CC = Range("g2").Value

emailItem.Subject = "Unreturned Techquidation Equipment"

emailItem.Body = "See the attached spreadsheet for unreturned items in your area"

'Attach current Workbook
emailItem.Attachments.Add ActiveWorkbook.FullName

'Attach any file from your computer.
'emailItem.Attachments.Add ("C:\...)"

'Send the email
'emailItem.send

'Display the email so the user can change it as desired before sending
emailItem.Display

Set emailItem = Nothing
Set emailApplication = Nothing

End Sub
This comment was minimized by the moderator on the site
Hi Chris,The code you provided has been modified. The Outlook signature can now be inserted into the message body. Please give it a try. Thank you.<div data-tag="code">Sub AST_Email_From_Excel()
'Updated by Extendoffice 20220211
Dim emailApplication As Object
Dim emailItem As Object
Set emailApplication = CreateObject("Outlook.Application")
Set emailItem = emailApplication.CreateItem(0)

' Now we build the email.
emailItem.Display 'Display the email so the user can change it as desired before sending
emailItem.to = Range("e2").Value
emailItem.CC = Range("g2").Value
emailItem.Subject = "Unreturned Techquidation Equipment"
emailItem.HTMLBody = "See the attached spreadsheet for unreturned items in your area" & "<br>" & emailItem.HTMLBody

'Attach current Workbook
emailItem.Attachments.Add ActiveWorkbook.FullName

Set emailItem = Nothing
Set emailApplication = Nothing

End Sub
This comment was minimized by the moderator on the site
Hi Crystal,Thank you for getting it to add the signature, doesn't appear to like the HTMLBody section though.When I run the macro, it debugs on emailItem.HTMLBody = "See the attached spreadsheet for unreturned items in your area" & "<br>" & emailItem.HTMLBodyand doesn't complete the rest.  
This comment was minimized by the moderator on the site
Hi,
Which Excel version are you using? The following VBA code also can help. Please give it a try. Thanks for your feedback.<div data-tag="code">Sub SendWorkSheet()
'Update by Extendoffice 20220218
Dim xFile As String
Dim xFormat As Long
Dim Wb As Workbook
Dim Wb2 As Workbook
Dim FilePath As String
Dim FileName As String
Dim OutlookApp As Object
Dim OutlookMail As Object
On Error Resume Next
Application.ScreenUpdating = False
Set Wb = Application.ActiveWorkbook
ActiveSheet.Copy
Set Wb2 = Application.ActiveWorkbook
Select Case Wb.FileFormat
Case xlOpenXMLWorkbook:
xFile = ".xlsx"
xFormat = xlOpenXMLWorkbook
Case xlOpenXMLWorkbookMacroEnabled:
If Wb2.HasVBProject Then
xFile = ".xlsm"
xFormat = xlOpenXMLWorkbookMacroEnabled
Else
xFile = ".xlsx"
xFormat = xlOpenXMLWorkbook
End If
Case Excel8:
xFile = ".xls"
xFormat = Excel8
Case xlExcel12:
xFile = ".xlsb"
xFormat = xlExcel12
End Select
FilePath = Environ$("temp") & "\"
FileName = Wb.Name & Format(Now, "dd-mmm-yy h-mm-ss")
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
Wb2.SaveAs FilePath & FileName & xFile, FileFormat:=xFormat
'xstr = Range("e2") & " ; " & Range("g2")
With OutlookMail
.Display
.To = Range("e2")
.CC = Range("g2")
.BCC = ""
.Subject = "Unreturned Techquidation Equipment"
.HTMLBody = "See the attached spreadsheet for unreturned items in your area" & "<br>" & .HTMLBody
.Attachments.Add Wb2.FullName
'.Send
End With
Wb2.Close
Kill FilePath & FileName & xFile
Set OutlookMail = Nothing
Set OutlookApp = Nothing
Application.ScreenUpdating = True
End Sub
This comment was minimized by the moderator on the site
Looks to be Excel 2016 and VBA 7.1
This comment was minimized by the moderator on the site
It's really helpful code
I need to change text format from right to left In the xOutMsg line
help please .
This comment was minimized by the moderator on the site
I am trying to integrate this code into the current format I currently have whereby I am able to automate emails within excel based on a set range of values. Any help in regard to where to add the 'signature' code within what I currently have would be much appreciated.

Public Sub CheckAndSendMail()

'Updated by Extendoffice 2018/11/22

Dim xRgDate As Range

Dim xRgSend As Range

Dim xRgText As Range

Dim xRgDone As Range

Dim xOutApp As Object

Dim xMailItem As Object

Dim xLastRow As Long

Dim vbCrLf As String

Dim xMailBody As String

Dim xRgDateVal As String

Dim xRgSendVal As String

Dim xMailSubject As String

Dim I As Long

On Error Resume Next

'Please specify the due date range

xStrRang = "D2:D110"

Set xRgDate = Range(xStrRang)

'Please specify the recipients email address range

xStrRang = "C2:C110"

Set xRgSend = Range(xStrRang)

xStrRang = "A2:A110"

Set xRgName = Range(xStrRang)

'Specify the range with reminded content in your email

xStrRang = "Z2:Z110"

Set xRgText = Range(xStrRang)

xLastRow = xRgDate.Rows.Count

Set xRgDate = xRgDate(1)

Set xRgSend = xRgSend(1)

Set xRgName = xRgName(1)

Set xRgText = xRgText(1)

Set xOutApp = CreateObject("Outlook.Application")

For I = 1 To xLastRow

xRgDateVal = ""

xRgDateVal = xRgDate.Offset(I - 1).Value

If xRgDateVal <> "" Then

If CDate(xRgDateVal) - Date <= 30 And CDate(xRgDateVal) - Date > 0 Then

xRgSendVal = xRgSend.Offset(I - 1).Value

xMailSubject = " JBC Service Agreement Expiring On The " & xRgDateVal

vbCrLf = "

"

xMailBody = ""

xMailBody = xMailBody & "Dear " & xRgName.Offset(I - 1).Value & vbCrLf

xMailBody = xMailBody & " " & xRgText.Offset(I - 1).Value & vbCrLf

xMailBody = xMailBody & ""

Set xMailItem = xOutApp.CreateItem(0)

With xMailItem

.Subject = xMailSubject

.To = xRgSendVal

.CC = ""

.HTMLBody = xMailBody

.Display

'.Send

End With

Set xMailItem = Nothing

End If

End If

Next

Set xOutApp = Nothing

End Sub
This comment was minimized by the moderator on the site
Thanks to you, I can add signature now but then it removes spaces between paragraph of text. Please Can you Help me ?


Sub helloworld()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Dim Path As String
Path = Application.ActiveWorkbook.Path
Set OutApp = CreateObject("Outlook.Application")

For Each cell In Range("C4:C6")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.Display
.To = cell.Value
.Subject = Cells(cell.Row, "D").Value
.HTMLBody = "Dear " & Cells(cell.Row, "B").Value & "," _
& vbNewLine & vbNewLine & _
"Warm Greetings" _
& vbNewLine & vbNewLine & _
"We, JK Overseas, would like to take an opportunity and introduce our company J K Overseas, which is involved in the salt business for the last 3 years. We are currently strong in domestic and expanding overseas. We are the supplier of Edible Salt, Water Softening Salt, De-icing Salt, Industrial Salt" & "." _
& vbNewLine & vbNewLine & _
"We have a tie-up with large scale manufacturers in India and procure from them quality Salt and exports. So, we are looking for a reliable expert importer as well as distributor agent to make a long-term Business with mutual benefit" & "." _
& vbNewLine & vbNewLine & _
"Please contact us with your requirement or for any other inquiries you may have. We provide reliable logistics and on-time delivery. We are confident that our prices being most competitive will match your expectations" & "." _
& vbNewLine & vbNewLine & _
.HTMLBody

'.Send
End With
Next cell
End Sub
This comment was minimized by the moderator on the site
Dear,
Can someone help me with my VBA,
I need the signature in the email created:
This comment was minimized by the moderator on the site
Hi, I would need help with my macro, I need to insert the Outlook signature under the table, could you help me with that?

Private Sub CommandButton1_Click()


Dim outlook As Object
Dim newEmail As Object
Dim xInspect As Object
Dim pageEditor As Object

Set outlook = CreateObject("Outlook.Application")
Set newEmail = outlook.CreateItem(0)

With newEmail
.To = Sheet5.Range("F1")
.CC = ""
.BCC = ""
.Subject = Sheet5.Range("B5")
.Body = Sheet5.Range("B41")
.display

Set xInspect = newEmail.GetInspector
Set pageEditor = xInspect.WordEditor

Sheet5.Range("B6:I7").Copy

pageEditor.Application.Selection.Start = Len(.Body)
pageEditor.Application.Selection.End = pageEditor.Application.Selection.Start
pageEditor.Application.Selection.PasteAndFormat (wdFormatPlainText)

.display
Set pageEditor = Nothing
Set xInspect = Nothing
End With

Set newEmail = Nothing
Set outlook = Nothing

End Sub
This comment was minimized by the moderator on the site
Hi Bara,
Sorry can't help you with that. Thanks for your comment.
This comment was minimized by the moderator on the site
Thanks a lot...
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations