Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Merge Word Doc To Email - Enable Edit

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
GB
is it possible via VBA to merge a word doc to email but open the email for editing?

if you issue execute it send the email, I want to have it in draft so I can then add my own attachments before it is sent.

any idea?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
What is your actual code ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Code:
Set wordapp = CreateObject("Word.Application")
    'Open document
    wordapp.Documents.Open sFile
  
    With wordapp.ActiveDocument.MailMerge
        .MainDocumentType = wdEMail
        .OpenDataSource Name:=cDrive & "\Members Database\FSA-AccessTemplates\EBS.xls", _
        ReadOnly:=True, Connection:=sTable, SubType:=wdMergeSubTypeWord, _
        SQLStatement:="Select * From [" & sTable & "]"
        .Destination = wdSendToEmail
        .MailSubject = sSubject
        .MailAddressFieldName = "EmailName"
        '.SentOnBehalfOfName = [Forms]![switchboard].[myref]
        .Execute
    End With

    wordapp.Quit False
        
    'free reference
    Set wordapp = Nothing

I was thinking maybe I could change .execute to .edit or .display?

I'm not quite at a point to test, so thought I'd throw it out there with TT and see what you guys thought!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
What about the EditMainDocument method instead of Execute ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
lol - i just found that option myself, i'll give it a whirl when I have the datasource coding done, and let you know :)

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
nope nothing happens!

do I need to issue something else, plus I don't want to edit main document, i want to edit created email from merge?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
It would seem there is no way I can merge to email without sending?

None of the option I try work, and you cannot attach files to the word doc only embed objects which is no good.

Has anyone else achieved this?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Does anyone know how to megre word to email and add attachments?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
I've made an FAQ for those interested :)

faq705-6950

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top