473,385 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to print a word document from Access

2
I have multiple documents that need to be printed on a daily basis and I want to create a Access form with buttons to print these documents.

I've created a form to open a word doc(s), but all I really need to do is just print the document.

I've got to imagine it's pretty simple, but I can't find anything in my searches to help me out.

Any ideas?
Mar 15 '10 #1
4 16831
NeoPa
32,556 Expert Mod 16PB
Opening a document in Word is relatively straightforward. There may even be a way (I expect there is - but it's not Access technical) to open it and print it immediately. If not however, you'll need to open it under the control of the Access code. This is a different issue altogether and requires Application Automation.
Mar 15 '10 #2
omajay
2
I've been able to find the code to print a Word doc from Access:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2. Set objWord = CreateObject("Word.Application")
  3. objWord.Visible = True
  4. Set objDoc = objWord.Documents.Add()
  5.  
  6. objWord.PrintOut , , , , , , , , , , , , "D:\Documents and Settings\jpapke\Desktop\macrotester.doc"
  7.  
  8. objWord.Quit
  9.  
  10. End Sub
Two other issues I must tackle are;

1) telling what tray to pull the paper from (I need it to pull tray #2 because it's yellow paper). I believe this is handled right after the PrintOut method above and should take the place of one of the "commas"

2) the other issue is that it's printing the "Document Settings" page after each time that I print. Any ideas on how to tell it to stop that?

Thank you,
Jay
Mar 15 '10 #3
TheSmileyCoder
2,322 Expert Mod 2GB
You can set the printer by using:
Expand|Select|Wrap|Line Numbers
  1. objWord.ActivePrinter = "CutePDF Writer"
I find that If I want to do stuff in Word or excel, the easiest is to start a macro recording, do the stuff I want, then stop the recorder and view the code. It might need small adaptations to work from within Access, but your 90% of the way there after looking at the macro.

That said, I don't know how to switch around the tray (Paper Source) :)
Mar 15 '10 #4
NeoPa
32,556 Expert Mod 16PB
@omajay
I don't believe so Jay. This is so easy to check though. Simply use the help system for the Application.PrintOut method. That lists all the parameters available, and what they are for. I did it already though, and I didn't find anything there to control which tray to use. You should really consider checking things out in Help before posting a question.
Mar 15 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Eager-Learner | last post by:
Through window.open or window.showmodaldialog, I want to open a word or excel document in Print Preview mode. Bcos I don't want the user to make any changes or save it but the user can ONLY VIEW OR...
1
by: Bill Short | last post by:
I would like to print a report (or reports) from Access based on the Word document I have open. For instance, the Word doc I have open is called 10-789-65.doc. From Word, I would like to open...
2
by: Joe Black | last post by:
Hi My database is filling a Word docs with data using bookmarks. My client wants one particular document to print using the lower tray which will hav a special letterhead loaded in it. Is...
1
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out...
1
by: pemigh | last post by:
Users want to click on a control and immediately ship a Publisher -- or PDF -- document to the printer. I found an old conversation with this code for Word: Dim wdApp As Word.Application Dim...
1
by: mikeyatsony | last post by:
Hi all... Is there a web for my ASP Web application tied to a SQL Server Express DB to print labels? I need a way to have reports printed from the user's browser. They wish to print labels...
1
by: troy_s11 | last post by:
I have vba code calling a word document and printing it. I need to merge some data from an access table to the word document before it prints. This needs to happen for a large list, so the...
0
by: 5anelli | last post by:
Hi to everyone, I need to create and print (from within a c# application) a MS Word document starting from an Access db. Half of this document must be written and printed in, let's say, January,...
1
by: kirkus84 | last post by:
I am currently trying to do a multiple record mail merge through a query via a command button on a form. The query basically displays customers who have said yes to privacy. The user inputs a date...
1
by: Quiris | last post by:
Hello, I have a Ms Access database, and linked some Ms Word documents to it, so I can print the data in the database nicely into a letter. In Word, I can search for a certain record of my...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.