A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Mail Merge Email



 
 
Thread Tools Display Modes
  #1  
Old July 13th, 2009, 09:32 PM posted to microsoft.public.access
Chip[_3_]
external usenet poster
 
Posts: 54
Default Mail Merge Email

Hey Everyone,

I'm not sure if this has been answered yet or not. Mr. Kallal's Super
Easy Mail Merge is working awesome for many of my applications. But I
was hoping someone could show me if there is an easy to augment this
code to send these mail merge documents, as attachments to an Outlook
email. I have some experience with Outlook coding in Access and I
have a rudementary application running. So I need to merge (sorry for
the pun) the two technologies; Mail Merge and Outlook.

Currently my Outlook code looks like this

On Error GoTo AddTask_Err
' Save record first to be sure required fields are filled.
DoCmd.RunCommand acCmdSaveRecord
Dim outobj As Outlook.Application
Dim outmail As Outlook.MailItem
Set outobj = CreateObject("outlook.application")
Set outmail = outobj.CreateItem(olMailItem)
With outmail
.To = " ' This will be changed to a
predetermined field.
.Subject = "Certification Course Approval"
.BodyFormat = olFormatHTML
.Actions
.Save
.Send
End With
' Release the Outlook object variable.
Set outobj = Nothing
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Approval Sent!"
Exit Sub
AddTask_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Exit Sub

And of course the super easy mail merge application code is
MergeSingleWord. I'm supposing that what I need is save the document
in MailMerge termporarily, then email the document as an attachment in
the Outlook Code. I know there is a .Attachment arguement but dont
know how to set its parameters.

This is going way beyond my expertise and I'm hoping someone can take
pity on me here... Any and all sugestions are appreciated..

Chip Franklin
  #2  
Old July 13th, 2009, 11:13 PM posted to microsoft.public.access
Albert D. Kallal
external usenet poster
 
Posts: 2,874
Default Mail Merge Email

The only problem here is does the user need to edit the word document and
THEN attach it?

Or, do you just need to choose an existing template, and merge + attached to
outlook?

If there is 2 or 3 templates that you know that you want to be send/attached
to outlook, then you can use the merge no prompts option.

eg:

MergeNoPrompts strFromDocTemplate, [strDir], [bolFullPath], [strOutPutDoc],
[strSql], [bolPrint], [strPrinter]

So, lets assume the template is "overdue". You could then go:

strDocName = "c:\mymerge.doc"

MergeNoPrompts "overdue",,false,"c:\myMerge.doc",,False


Set outmail = outobj.CreateItem(olMailItem)
With outmail
.To = " ' This will be changed to a
predetermined field.
.Subject = "Certification Course Approval"
.BodyFormat = olFormatHTML


.Attachments.Add (strDocName) --- add this


The above is the general approach here.

So, add the code to save/create the merged document into a folder. And then
add the attachments.Add to the outlook code to attach that word document.

You could have 2 or 3 differnt buttons on the form to allow the user to
choose what email.

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada




  #3  
Old July 14th, 2009, 11:17 AM posted to microsoft.public.access
jessie
external usenet poster
 
Posts: 1
Default Mail Merge Email

I would like to know how I can possibly sign onto the internet. I have just
purchased a laptop and unfortunately the so called administrator doesn't
remember the p word. help i have vista and I dont know anything about this
os
"Chip" wrote in message
...
Hey Everyone,

I'm not sure if this has been answered yet or not. Mr. Kallal's Super
Easy Mail Merge is working awesome for many of my applications. But I
was hoping someone could show me if there is an easy to augment this
code to send these mail merge documents, as attachments to an Outlook
email. I have some experience with Outlook coding in Access and I
have a rudementary application running. So I need to merge (sorry for
the pun) the two technologies; Mail Merge and Outlook.

Currently my Outlook code looks like this

On Error GoTo AddTask_Err
' Save record first to be sure required fields are filled.
DoCmd.RunCommand acCmdSaveRecord
Dim outobj As Outlook.Application
Dim outmail As Outlook.MailItem
Set outobj = CreateObject("outlook.application")
Set outmail = outobj.CreateItem(olMailItem)
With outmail
.To = " ' This will be changed to a
predetermined field.
.Subject = "Certification Course Approval"
.BodyFormat = olFormatHTML
.Actions
.Save
.Send
End With
' Release the Outlook object variable.
Set outobj = Nothing
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Approval Sent!"
Exit Sub
AddTask_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Exit Sub

And of course the super easy mail merge application code is
MergeSingleWord. I'm supposing that what I need is save the document
in MailMerge termporarily, then email the document as an attachment in
the Outlook Code. I know there is a .Attachment arguement but dont
know how to set its parameters.

This is going way beyond my expertise and I'm hoping someone can take
pity on me here... Any and all sugestions are appreciated..

Chip Franklin


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:55 PM.


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