Posted to microsoft.public.excel.programming
|
|
VBA and Mail
Page is ready
Insert Outlook Signature in mail
http://www.rondebruin.nl/mail/folder3/signature.htm
--
Regards Ron de Bruin
http://www.rondebruin.nl
"Ron de Bruin" wrote in message ...
Hi Mike
One example
I test more with Bob this evening and publish a example on my mail page then
Sub Mail_Test_Outlook()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "Hi there" & vbNewLine & vbNewLine & _
"This is line 1" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4"
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = strbody & vbNewLine & vbNewLine & _
GetBoiler("C:\Documents and Settings\Ron\Application Data\Microsoft\Signatures\Untitled.txt")
.display 'or use .Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Function GetBoiler(ByVal sFile As String) As String
'Dick 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
--
Regards Ron de Bruin
http://www.rondebruin.nl
"Bob Phillips" wrote in message ...
I don't think so, but if you are using Outlook, then the signatures are
stored in a file in an MS directory (mine are in C:\Documents and
Settings\Bob\Application Data\Microsoft\Signatures). For instance, if you
named the signature mySig, then you will have mySig.txt, mySig.htm, and
mySig.rtf in there. You could open one of those files, read the signature
and include it in your string that you set to the Body or HTMLBody
properties.
For example, to get the data
Dim sSignature As String
Dim sData As String
Dim sFilename As String
Dim iFreefile As Long
sFilename = "C:\Documents and Settings\Bob\Application
Data\Microsoft\Signatures\mySig.txt"
iFreefile = FreeFile
Open sFilename For Input As iFreefile
Do While Not EOF(iFreefile)
Line Input #iFreefile, sData
sSignature = sSignature & vbnewlijne & sData
Loop
Close iFreefile
:
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Mike" wrote in message
...
I've got a script that generates e-amil for me. Everything works fine,
but I
want to add a signature. Is there some way to have the script use a
premade
signature or template? Here's the script.
With objMail
' .BCC = jr3411
.To = ADDY$
.Subject = oSheet.Cells(4, 3).Value & " - " & oSheet.Cells(1, 2).Value
&
" - " & oSheet.Cells(5, 3).Value
.Body = MSG$ & vbCrLf & vbCrLf & cKt$
.Display
End With
|