Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Access and Word Forms
Gary 

12 years ago
Richard, Thought you would like to try this bit of code I found. It uses Access to fill out MS Word forms. To get it to work I had to enable the Microsoft Word 14.0 object library in the vb editor in access, enabled the developer tab in Word and use the form fields controls from the legacy group for access 2010. From there create your form in word and for each of the legacy text field properties name your book marks and in the code under the with statement match your MS Word fields to your access fields. works like a champ.

However maybe you can help me? I would like to throw this code into a module and pass the path information to it, easy enough but the problem I run into is when its in a module the with statement doesn't recognize me.fname portion. Is there a simple way to set the module to the table I am using. I tried several different ways that didn't work. Any help?

Thanks, Gary
    

Private Sub Command358_Click()

Dim appWord As Word.Application
Dim doc As Word.Document

On Error Resume Next
Error.Clear

Set appWord = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set appWord = New Word.Application
End If
Set doc = appWord.Documents.Open("C:\Users\Gary\Desktop\New folder\test.docx", , True)
With doc
    .FormFields("TFname").Result = Me.FName
appWord.Visible = True
appWord.Activate

End With

Set doc = Nothing

Set appWord = Nothing

End Sub


Reply from Richard Rost:

Looks awesome. How about just sending the form name to the function? Might solve the problem (cheesy, but it should work).

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/16/2026 3:28:31 AM. PLT: 1s