Mavro chose specific mail signature

blaksnm

Well-known Member
Joined
Dec 15, 2009
Messages
554
Office Version
  1. 365
Platform
  1. Windows
Hi guys
I have a macro-routine that generates a mail, and use default signature all right.
However I want my macro to use another signature - called "Example" in stead of my default MS Oulook signature
Could this be done - I think it has do with "HTMLBody or something, but don't know how to solve this problem?

Relevant exstract of my macro:
With OutMail
.Display
.To = Range("Mail1").Value
.CC = Range("MailCopy").Value
.BCC = ""
.Subject = Range("Subject1").Value
.HTMLBody = strbody & "<H4><br>" & .HTMLBody
.Attachments.Add (Range("FakturaNr").Value)
'.Send (I don't want to send he mail automticly in this case)
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
I am sorry - the macro did not catch SigString = Environ("appdata") & "\Microsoft\Signatures\example.htm" as signature.

Something is going wrong here:
SigString = Environ("appdata") & "\Microsoft\Signatures\example.htm"

If Dir(SigString) <> "" Then
Signature = GetBoiler(SigString)
Else
Signature = ""
End If

Function:
Function GetBoiler(ByVal sFile As String) As String
'**** Kusleika
Dim fso As Object
Dim ts As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2)
GetBoiler = ts.readall
ts.Close
End Function
 
Upvote 0
Re: Macro chose specific mail signature

Hi i have the following macro and i need to insert a specific email signature called "Avon", i don't know much about macros so if someone could insert the right code in the right place for me i would appreciate it a lot!

Sub Emailtoclient()

strPath = Environ$("temp") & "\"

strFName = ActiveSheet.Range("I12")
strFName = Range("J5") & "-" & ActiveSheet.Range("H12") & ".pdf"

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
strPath & strFName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False

Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim strbody As String
Dim wddoc As Object
Dim olInsp As Object

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)

On Error Resume Next
With OutMail
.BodyFormat = 1
.Display
.To = Range("H14").Value
.CC = ""
.BCC = ""
.Subject = "Avon invoice" & "-" & Range("J5")

Set olInsp = .GetInspector
Set wddoc = olInsp.WordEditor

wddoc.Range.InsertBefore "Good Day" & " " & Range("H12") & "," & vbCr & vbCr & "Thank you for your order in brochure" & " " & Range("J8") & vbCr & "Please find attached herewith your invoice" & "-" & Range("J5") & vbCr & vbCr
.Attachments.Add strPath & strFName
.SendUsingAccount = OutApp.Session.Accounts.Item(3)



End With

Kill strPath & strFName
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,486
Messages
6,113,932
Members
448,533
Latest member
thietbibeboiwasaco

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top