G
Guest
I'm using access 2003
I created the folowing function to attach files and it works good:
Function EmailAttachFile()
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim AttachFile As String
Dim strTO As String
Dim strCC As String
Dim strBCC As String
Dim strSubj As String
Dim strBody As String
AttachFile = "C:\Test.doc"
strTO = "(e-mail address removed)"
strCC = ""
strBCC = ""
strSubj = "This is message xxdt Daily repor"
strBody = "This is body test xxdt. Type comments"
Set objOutlook = CreateObject("Outlook.Application") ' Create the
Outlook session.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem) ' Create
the message.
With objOutlookMsg
.To = strTO
.CC = strCC
.BCC = strBCC
.Subject = strSubj
.Body = strBody
End With
If Dir(AttachFile) <> "" Then objOutlookMsg.Attachments.Add AttachFile
objOutlookMsg.Display
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Function
However, I would like improve some features.
Questions:
1. How can replace a word in the body text for another word?
Im my example how can I replace xxdt in body text and in subject by:
format(Date, "yyyy-mm-dd")
2. In the body text, the space after paragraphs looks 12pt. It looks as the
following example:
1. First paragraph
2. second paragraph
How can remove the space between paragraphs?
Thanks
jcp
I created the folowing function to attach files and it works good:
Function EmailAttachFile()
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim AttachFile As String
Dim strTO As String
Dim strCC As String
Dim strBCC As String
Dim strSubj As String
Dim strBody As String
AttachFile = "C:\Test.doc"
strTO = "(e-mail address removed)"
strCC = ""
strBCC = ""
strSubj = "This is message xxdt Daily repor"
strBody = "This is body test xxdt. Type comments"
Set objOutlook = CreateObject("Outlook.Application") ' Create the
Outlook session.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem) ' Create
the message.
With objOutlookMsg
.To = strTO
.CC = strCC
.BCC = strBCC
.Subject = strSubj
.Body = strBody
End With
If Dir(AttachFile) <> "" Then objOutlookMsg.Attachments.Add AttachFile
objOutlookMsg.Display
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Function
However, I would like improve some features.
Questions:
1. How can replace a word in the body text for another word?
Im my example how can I replace xxdt in body text and in subject by:
format(Date, "yyyy-mm-dd")
2. In the body text, the space after paragraphs looks 12pt. It looks as the
following example:
1. First paragraph
2. second paragraph
How can remove the space between paragraphs?
Thanks
jcp