Computing.Net > Forums > Programming > Opening Word Mail Merge from Access

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Opening Word Mail Merge from Access

Reply to Message Icon

Name: pappy1271
Date: July 10, 2002 at 12:59:15 Pacific
Comment:

I am trying to open a predefined mail merge document from access us VBA and when the document opens it opens another instance of Access. I used Q159328 for the programming and found another article for this similar problem (Q199963) but nothing seems to help. Any assistance would be greatly appreciated.



Sponsored Link
Ads by Google

Response Number 1
Name: A Certain TH
Date: July 11, 2002 at 01:18:30 Pacific
Reply:

Hi John

This is ripped out of a database I've just rebuilt. Its not pretty, but it works. There may be better ways, but this is the best I can do in 97. I hope its as self-explanatory as you need.

"AccessDataString$" contains the text I want to be merged, in fields seperated by a delimiting character which the destination Word template is expecting.

"MergeTemplate.doc" is set up to expect to be based on a datasource called "TextForMerge.doc".

You may want to bugger about to make the template read-only. You can do this with the "Open" statement or in the file properties. Or you can tell Word that its already saved it, so it won't ask you for it.

Cheers
Tom


Sub exportdata()
Dim AccessDataString$
Dim objword As New Word.Document

objword.Content.Text = AccessDataString$
objword.Application.Options.SavePropertiesPrompt = False

objword.SaveAs ("c:TextForMerge.doc")

Word.Documents.Open "c:MergeTemplate.dot"

ActiveDocument.MailMerge.Execute

ActiveDocument.Application.Visible = True

End Sub


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Opening Word Mail Merge from Access

MS Access mail merge to MS Word www.computing.net/answers/programming/ms-access-mail-merge-to-ms-word/7235.html

Word Mail-Merge Macro www.computing.net/answers/programming/word-mailmerge-macro/5469.html

access to open word file www.computing.net/answers/programming/access-to-open-word-file/3691.html