Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-02-2013, 11:17 AM
KSReynolds KSReynolds is offline Print All Word Documents in an Access Table Windows 7 32bit Print All Word Documents in an Access Table Office 2003
Novice
Print All Word Documents in an Access Table
 
Join Date: Oct 2013
Posts: 7
KSReynolds is on a distinguished road
Default Print All Word Documents in an Access Table


I have an Access table that holds the paths od existing word documents. I would like to print all of these documents from Word. Is there a way to do that?
Reply With Quote
  #2  
Old 12-02-2013, 05:35 PM
macropod's Avatar
macropod macropod is offline Print All Word Documents in an Access Table Windows 7 32bit Print All Word Documents in an Access Table Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,343
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Since you're working in Access, you would need to use a macro that:
• starts a Word session;
• loads, prints & closes a document from the table;
• loop until all documents have been processed; and
• terminates the Word session.
The code for that would be something like:
Code:
Sub Demo()
Dim wdApp As Word.Application
Set wdApp = New Word.Application
Dim wdDoc As Word.Document
i As Long
wdApp.Visible = True
With TableItems
  For i = 1 To .Count
    Set wdDoc = wdApp.Documents.Open(Item(i))
    With wdDoc
      .PrintOut
      .Close False
    End With
  Next
End With
wdApp.Quit
Set wdDoc = Nothing: Set wdApp = Nothing
End Sub
where 'TableItems' refers to your Access table (I'm not familiar with Access VBA). Note that you'd also need to set a reference to the Word Object Library.

PS: Once you're confident the code is working correctly, you can change 'wdApp.Visible = True' to 'wdApp.Visible = False'.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate dropdown list with data from Access table spw4000 Office 0 02-24-2012 05:22 AM
Pulling email address from access table into outlook Abacus1234 Outlook 0 11-10-2011 01:31 PM
Print All Word Documents in an Access Table Access to the property of the current table b0x4it Word VBA 2 05-26-2011 06:25 AM
Can I fill in Word document from Access table and/or query? slim_jim_56 Word Tables 0 10-03-2007 01:59 PM
print vba button in access causes program crash de_la_espada Office 0 09-20-2005 04:46 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:39 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft