Anne Troy
MrExcel MVP
- Joined
- Feb 18, 2002
- Messages
- 2,632
- Office Version
- 365
- Platform
- Windows
Got the code from Ron de Bruin, but can't seem to make it work. The whole thing was working good so far, though I am not really done with the body. I added the signature in every possible way, but it simply doesn't put my signature in. Yes, the file exists in the path given. He used the "environ" string, but I hard-coded it just to see if that was part of the problem, and it changed nothing.
Help!
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 TestFile()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Dim strbody As String
Dim SigString As String
Dim Signature As String
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
On Error GoTo cleanup
For Each cell In Rows("3").Cells.SpecialCells(xlCellTypeConstants)
If cell.Value Like "?*@?*.?*" Then
' And _
' LCase(Cells(cell.Row, "C").Value) = "yes"
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = cell.Value
.Subject = "POS Order Update: " & Range("D7").Text & " " & Range("E7").Text
.Body = "Hi, " & Range("c7").Text & "!" & Chr(10) & Chr(10) & _
Range("D10").Text & " has been assigned to program your Point of Sale database."
.Display 'Or use Send
SigString = "C:\Users\atroy\AppData\Roaming\Microsoft\Signatures\AnneTroyHT.htm"
End With
On Error GoTo 0
If Dir(SigString) <> "" Then
Signature = GetBoiler(SigString)
Else
Signature = ""
End If
Set OutMail = Nothing
End If
Next cell
cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
Help!