Anne Troy
MrExcel MVP
- Joined
- Feb 18, 2002
- Messages
- 2,632
- Office Version
- 365
- Platform
- Windows
I'm using a bunch of code that VoG helped me with (VoG is a GoD!), and adding some Ron De Bruin (another GoD) code. Everything works except adding the html signature. Yes, the file exists in the path shown.
Code:
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
Sub FinalEmail()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Dim strbody As String
Dim SigString As String 'Anne
Dim Signature As String 'Anne
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
On Error GoTo cleanup
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = Range("'Dashboard'!D3").Text
.CC = Range("'Dashboard'!D4").Text & ";" & Range("'Dashboard'!D5").Text & Range("adminemail").Text
.BCC = Range("'Dashboard'!D6").Text
.Subject = "XXXXX POS Order Update: " & Range("merchantname").Text & " " & Range("merchantmid").Text
.Body = Range("'Email Text'!$C$15").Text & Chr(10) & Chr(10) & _
Range("'Email Text'!$C$16").Text & Chr(10) & _
Range("'Email Text'!$C$17").Text & Chr(10) & _
Range("'Email Text'!$C$18").Text & Chr(10) & _
Range("'Email Text'!$C$19").Text & Chr(10) & _
Range("'Email Text'!$C$20").Text & Chr(10) & _
Range("'Email Text'!$C$21").Text & Chr(10) & _
Range("'Email Text'!$C$22").Text & Chr(10) & _
Range("'Email Text'!$C$23").Text & Chr(10) & _
Range("'Email Text'!$C$24").Text & Chr(10) & _
Range("'Email Text'!$C$25").Text & Chr(10) & _
Range("'Email Text'!$C$26").Text & Chr(10) & _
Range("'Email Text'!$C$27").Text & Chr(10) & _
Range("'Email Text'!$C$28").Text & Chr(10) & _
Range("'Email Text'!$C$29").Text & Chr(10) & _
Range("'Email Text'!$C$30").Text & Chr(10) & _
Range("'Email Text'!$C$31").Text & Chr(10) & _
Range("'Email Text'!$C$32").Text & Chr(10) & _
Range("'Email Text'!$C$33").Text & Chr(10) & _
Range("'Email Text'!$C$34").Text & Chr(10) & Chr(10)
SigString = "C:\Users\atroy\AppData\Roaming\Microsoft\Signatures\AnneTroyHT.htm"
If Dir(SigString) <> "" Then
Signature = GetBoiler(SigString)
Else
Signature = ""
End If
If Range("'Dashboard'!G10").Text = "Hospitality" Then
With OutMail
.Attachments.Add ("C:\SendingFiles\MerchantHelperApplication.xlsx")
.Attachments.Add ("C:\SendingFiles\MenuOrganization.xlsx")
.Display 'Or use Send
End With
ElseIf Range("'Dashboard'!G10").Text = "Retail" Then
With OutMail
If Range("'Dashboard'!G10").Text = "Retail" Then
.Attachments.Add ("c:\SendingFiles\RetailStandardImport.xlsx") ' you will need to add the correct file name here
.Display
End If
End With
End If
On Error GoTo 0
Set OutMail = Nothing
cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End With
End Sub