If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
From Access, print a word doc
Does anyone know a slice of VB code that would let me
print a specific word document by clicking a button in Access? I have a request to print some standard handouts in addition to every time we print a certain signup report from Access. (this way all documents are at the printer together, and we don't have to remember to pull copies out of the file. Saves a lot of time.) In the past I have imported the document into Access as a report, but this latest request is 4 pages long and difficult to reformat to look right coming out of Access. It would be nice if I could just send the word document to the printer right after the report. Thanks in advance. |
#2
|
|||
|
|||
From Access, print a word doc
Sub PrintWordDoc(strPathAndFileName as String) On Error resume Next Dim objWord as Object Dim objDoc as Object Const wdPrintAllDocument = 0 Set objWord = CreateObject("Word.Application") objWord.visible = False Set objDoc = objWord.Documents.Open(strPathAndFileName) objWord.ActiveDocument.PrintOut , _ Background:=False, _ Range:=wdPrintAllDocument objDoc.Close False Set objDoc = Nothing objWord.Quit Set objWord = Nothing End Sub That should do it -- Steve Arbaugh ACG Soft http://ourworld.compuserve.com/homepages/attac-cg "RC" wrote in message ... Does anyone know a slice of VB code that would let me print a specific word document by clicking a button in Access? I have a request to print some standard handouts in addition to every time we print a certain signup report from Access. (this way all documents are at the printer together, and we don't have to remember to pull copies out of the file. Saves a lot of time.) In the past I have imported the document into Access as a report, but this latest request is 4 pages long and difficult to reformat to look right coming out of Access. It would be nice if I could just send the word document to the printer right after the report. Thanks in advance. |
#3
|
|||
|
|||
From Access, print a word doc
That works. Thanks. I was getting there, but missed the
bit for opening the document. This really helps. RC -----Original Message----- Sub PrintWordDoc(strPathAndFileName as String) On Error resume Next Dim objWord as Object Dim objDoc as Object Const wdPrintAllDocument = 0 Set objWord = CreateObject("Word.Application") objWord.visible = False Set objDoc = objWord.Documents.Open(strPathAndFileName) objWord.ActiveDocument.PrintOut , _ Background:=False, _ Range:=wdPrintAllDocument objDoc.Close False Set objDoc = Nothing objWord.Quit Set objWord = Nothing End Sub That should do it -- Steve Arbaugh ACG Soft http://ourworld.compuserve.com/homepages/attac-cg "RC" wrote in message ... Does anyone know a slice of VB code that would let me print a specific word document by clicking a button in Access? I have a request to print some standard handouts in addition to every time we print a certain signup report from Access. (this way all documents are at the printer together, and we don't have to remember to pull copies out of the file. Saves a lot of time.) In the past I have imported the document into Access as a report, but this latest request is 4 pages long and difficult to reformat to look right coming out of Access. It would be nice if I could just send the word document to the printer right after the report. Thanks in advance. . |
Thread Tools | |
Display Modes | |
|
|