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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|