L
Ludo
Hi,
I use following code to create a mail using Outlook from within Excel.
I created a template file (BeLUG vzw.htm) that resides in :
C:\Program Files\Common Files\Microsoft Shared\Letter
Now, i need to use this specific letter template.
Question is: what code lines do i need to add to the code here below
to create a mail with the desired letter template?
Sub Mail_workbook_Outlook_1()
'Working in 2000-2007
' source : http://www.rondebruin.nl/tips.htm
Dim OutApp As Object
Dim OutMail As Object
Const sMsg2 = "Send methode = Outlook"
szSection = "Expence"
szKey = "Mail Address1"
MailTo1 = GetIniKey(szFile, szSection, szKey)
szKey = "Mail Address2"
MailTo2 = GetIniKey(szFile, szSection, szKey)
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = MailTo1
If MailTo2 <> "0" Then
.CC = MailTo2
End If
.Subject = wbName
.Body = sMsg & vbCrLf & sMsg2
.Attachments.Add wbPathName
.Display '.Send '
End With
On Error GoTo 0
OutApp.Session.Logoff
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Thanks for any help.
Regards,
Ludo
I use following code to create a mail using Outlook from within Excel.
I created a template file (BeLUG vzw.htm) that resides in :
C:\Program Files\Common Files\Microsoft Shared\Letter
Now, i need to use this specific letter template.
Question is: what code lines do i need to add to the code here below
to create a mail with the desired letter template?
Sub Mail_workbook_Outlook_1()
'Working in 2000-2007
' source : http://www.rondebruin.nl/tips.htm
Dim OutApp As Object
Dim OutMail As Object
Const sMsg2 = "Send methode = Outlook"
szSection = "Expence"
szKey = "Mail Address1"
MailTo1 = GetIniKey(szFile, szSection, szKey)
szKey = "Mail Address2"
MailTo2 = GetIniKey(szFile, szSection, szKey)
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = MailTo1
If MailTo2 <> "0" Then
.CC = MailTo2
End If
.Subject = wbName
.Body = sMsg & vbCrLf & sMsg2
.Attachments.Add wbPathName
.Display '.Send '
End With
On Error GoTo 0
OutApp.Session.Logoff
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Thanks for any help.
Regards,
Ludo