how do i print document/s in different locations using a macro

N

Nibblee

I would like to print 1 or more documents from different locations using the
one macro in word 2007
 
N

Nibblee

I should have added that I have been using 'record macro' which works a
treat, but as i have a number of documents to print at the same time I was
hoping to make the process a little easier and that someone may be able to
assist. As you might have guessed, I'm relitively new to writing codes. thanks
 
G

Graham Mayor

You can only print documents sequentially after having opened them in Word.
Something along the lines of

Sub OpenAndPrint()
Dim vFname(3) As Variant
Dim oDoc As Document
vFname(0) = "d:\My Documents\Word Documents\Limitations on Use.docx"
vFname(1) = "d:\My Documents\Word Documents\Filename.doc"
vFname(2) = "d:\My Documents\Word Documents\Follow.doc"
vFname(3) = "d:\My Documents\Word Documents\Lorem.docx"

For i = 0 To UBound(vFname)
Set oDoc = Documents.Open(FileName:=vFname(i))
oDoc.PrintOut
oDoc.Close wdDoNotSaveChanges
Next i
End Sub

will do the job. Change the filenames and paths as appropriate
http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
N

Nibblee

Thanks very much Graham, Ive been racking my brain all day, I'll try this,
youve been a great help
 
G

Graham Mayor

You are welcome :)

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top