Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default VBA and Mail

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default VBA and Mail

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default VBA and Mail

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





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
E-Mail attachment to same e-mail address in Outlook Vick Excel Discussion (Misc queries) 4 May 17th 07 07:53 PM
Error: cannot load the mail service. Check your mail installation. Brad Bowser Excel Discussion (Misc queries) 0 December 20th 05 10:03 PM
General mail failure when sending e-mail from Excel Adrienne Excel Discussion (Misc queries) 5 November 4th 05 12:59 PM
Creating TWO-WAY E-Mail Attachments with 'BeforeSave Events' in Code for 2nd E-Mail Chuckles123[_112_] Excel Programming 0 September 8th 05 05:56 PM


All times are GMT +1. The time now is 02:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"