Printing and moving word documents

  reddwarfcrew 21:42 18 Mar 2006

Hi, I have a folder with 2 subfolders:

a) J:\Printing\Docs to be printed
b) J:\Printing\Docs sent to be printed

What I would like to do is have a vba macro in word that does the following:

1. Prints the 5 oldest docs in folder a (if possible based on last modified time)
2. Then move these documents from folder a into folder b

Is this possible, I'm sure it is, but not really sure where to start


  wbiggchiefy 21:56 18 Mar 2006

Try Macro Express - if you search on google for free macro creator applications this will appear on the list ....
If you want to get hold of a custom written macro for exactly what u want to do/print try going to microsoft click on knowledge base click the prog u want to print from & ask the experts - this is no detraction from PC Advisor readers or forum members but as this is world wide and has hundreds of thousands of members it would probably serve your needs in about 15 minutes - it has helped me out many a time with excel formulae etc.and gave me a macro to delete blank fields saving me hours at work too!


  reddwarfcrew 22:34 18 Mar 2006

I've been hunting around and I think I may need a combination of the 'Move Method' in VBA and

file = Dir("J:\Printing\Docs to be printed\*.doc")
While file <> ""
Documents.Open FileName:=file
ActiveDocument.PrintOut Background:=False, Copies:=1
ActiveDocument.Close SaveChanges:=wdSaveChanges
file = Dir()

  reddwarfcrew 23:18 18 Mar 2006

The code below works, but only prints in alphabeical order when I'd prefer date modified (or even created order)

Any clues on getting me over the final hurdle?

Sub PrintAndMove()
' PrintAndMove Macro
' Macro recorded 18/03/2006 by Steve Allen
Dim count As Integer
Dim file As String
count = 0

While count < 5
ChangeFileOpenDirectory _
"J:\Printing\To be printed\"
file = Dir("*.doc")
Documents.Open FileName:=file
ActiveDocument.PrintOut Background:=False, Copies:=1
ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
OldFilePath = "J:\Printing\To be printed\" & file
NewFilePath = "J:\Printing\Printed\" & file
Name OldFilePath As NewFilePath ' move the file
file = Dir()
count = count + 1


MsgBox (count & " documents have been sent to print and moved to the 'printed' folder")

End Sub

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Samsung Galaxy A8 review: Hands-on

Illustrator Juan Esteban Rodriguez on creating highly detailed official film posters for Star Wars…

iMac Pro review

Meilleurs drones (2018)