Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 16th, 2005, 05:10 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default Word Merge with Access VBA

I need to merge data from Access into a Word Document using VBA in Access. I have found several solutions online, but all are very complex and full of bugs. Does anyone know a good simple way to Open a document, merge data in from Access, or directly assign values to merge fields, and the allow the user to print or save the document?

Thanks in advance.

Mike

Mike
EchoVue.com
__________________
Mike
EchoVue.com
Reply With Quote
  #2 (permalink)  
Old October 16th, 2005, 05:22 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Not to worry...

I found some very simple code that works well - It may not be the best way of doing it, but it should work, and keep it all very simple.

 Dim objWord As Object

 Set objWord = GetObject("C:\WordDocs\Agreement.doc")

 objWord.Application.Visible = True
 objWord.Bookmarks("CompanyName").Select
 objWord.Application.Selection.Text = "ACME Corp Limited"

This pulls it up in Word, and then I can let the user manipulate it, or do whatever from there.

Thanks

Mike

Mike
EchoVue.com
Reply With Quote
  #3 (permalink)  
Old October 16th, 2005, 05:38 PM
Authorized User
 
Join Date: Oct 2005
Location: South Ockendon, Essex, United Kingdom.
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Figgis
Default

I suppose the other way you could do it is to create a report in Access and then show the user how to publish it with word. That's all I've ever done. There probably is a VBA method for doing the same thing but as its so easy to do I have never bothered doing it any other way
Reply With Quote
  #4 (permalink)  
Old October 16th, 2005, 05:43 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Huh! I have never played with the Publish to Word functions. Does that effectively just move the report to word so that the user can edit it?

Thanks

Mike

Mike
EchoVue.com
Reply With Quote
  #5 (permalink)  
Old October 16th, 2005, 06:58 PM
Authorized User
 
Join Date: Oct 2005
Location: South Ockendon, Essex, United Kingdom.
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Figgis
Default

yes pretty much. you have to preview the report first then you can publish with Word or Excel. I think you could probably set up a macro to handle it if you did not want the users to manually choose what to do with it
Reply With Quote
  #6 (permalink)  
Old October 17th, 2005, 11:24 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: Clinton, UT, USA.
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Thank Figgis,

This probably isn't the best solution for this particular problem, but I have another that I have been working on for a while, that this will save a lot of headaches on.



Mike
EchoVue.com
Reply With Quote
  #7 (permalink)  
Old May 5th, 2006, 05:11 PM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

where is the best place to place this code to open as a word document when opening a report?
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Pushing" from Access to Word via Mail Merge Loralee BOOK: Access 2003 VBA Programmer's Reference 2 March 8th, 2006 10:20 PM
Access launching Word for mail merge Loralee Access 8 November 14th, 2005 04:24 PM
Access/Vba mail merge to word help alfonse Access VBA 0 July 28th, 2005 05:11 AM
Access to word merge missing link ? blade59 Access VBA 0 September 9th, 2004 04:36 PM
Access OLE Merge to Word GregoryHu Access VBA 5 May 7th, 2004 10:18 AM



All times are GMT -4. The time now is 08:22 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.