PDA

View Full Version : Sleeper: Simple Print Word doc from Excel



Anne Troy
04-29-2005, 11:54 AM
On click of a button in Excel, I want a dialog/msgbox to pop up asking how many copies they would like to print, and it prints that many copies of a specific Word document that resides in the SAME folder as the Excel file. We can call the Word doc "cover.doc".

Anybody?

MOS MASTER
04-29-2005, 12:17 PM
Hi Princess, :bow:

Something like:


Sub PrintWordDoc()
Dim oWord As Object
Dim sPath As String
Dim iCnt As Integer
sPath = ThisWorkbook.Path & Application.PathSeparator & "Cover.doc"
iCnt = Val(InputBox("How many copies", "Print Word doc", 1))
If iCnt >= 1 Then
Set oWord = CreateObject(Class:="Word.Application")
With oWord.Documents.Open(sPath)
.PrintOut Background:=False, Copies:=iCnt
.Close False
End With
oWord.Quit False
End If
Set oWord = Nothing
End Sub


Enjoy! :whistle:

MOS MASTER
05-01-2005, 11:19 AM
Hi Anne, :D

Did this work for you? ;)

Anne Troy
05-01-2005, 11:25 AM
Well, of course something else came up, but I will try it VERY soon! :D

MOS MASTER
05-01-2005, 11:28 AM
Hi Princess, :bow:

Ah..ok..hope it works for yah...:cloud9: