#1   Report Post  
Posted to microsoft.public.word.docmanagement
milo19 milo19 is offline
external usenet poster
 
Posts: 11
Default Print multiple files

I want to be able to highlight multiple Word 2007 documents and print them in
the order that they appear in the selection. Word will print the files, but
not in the correct order. How can I print many files in the correct order?
--
Gina M
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Print multiple files

This is a Windows issue. One way to overcome the problem is to beat it with
a blunt instrument. The following macro allows you to select a list of
files. The filenames are then loaded into a Word document and sorted into
alphabetical order. (To print in a preferred random order is somewhat more
complicated and you would have to use a method like that employed in my
boiler add-in to assemble the files in order before processing them - in
fact I might create an add-in to do just that if I have a few minutes
spare)

The files listed in the document are then opened in the order they are now
presented, printed and closed.

Sub BatchPrint()
Dim strPath As String
Dim oDoc As Document, oPrDoc As Document
Dim oRng As Range
Dim i As Long, iNum As Long
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.title = "Select files to print and click OK"
.AllowMultiSelect = True
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User", , _
"Print Files"
Exit Sub
End If
End With
Set oDoc = Documents.Add
iNum = fDialog.SelectedItems.Count
For i = 1 To iNum
strPath = fDialog.SelectedItems.Item(i)
oDoc.Range.InsertAfter strPath
If i fDialog.SelectedItems.Count Then
oDoc.Range.InsertAfter vbCr
End If
Next i
oDoc.Range.Sort
For i = 1 To iNum
Set oRng = oDoc.Paragraphs(i).Range
oRng.End = oRng.End - 1
MsgBox oRng.Text
WordBasic.DisableAutoMacros 1
Set oPrDoc = Documents.Open(oRng.Text)
oPrDoc.PrintOut
oPrDoc.Close wdDoNotSaveChanges
WordBasic.DisableAutoMacros 0
Next i
End Sub
http://www.gmayor.com/installing_macro.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



milo19 wrote:
I want to be able to highlight multiple Word 2007 documents and print
them in the order that they appear in the selection. Word will print
the files, but not in the correct order. How can I print many files
in the correct order?



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Print multiple files

If you want to try it, I have posted the add-in on my web site at
http://www.gmayor.com/Zips/Word_Batch_Print.zip but the documentation will
have to wait until tomorrow. It is however fairly straightforward. If you
install the 2007 version, you will get a button on the developer tab of the
ribbon, which will activate a userform. Pick the files you want to print and
it will print them in the order they are listed.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Graham Mayor wrote:
This is a Windows issue. One way to overcome the problem is to beat
it with a blunt instrument. The following macro allows you to select
a list of files. The filenames are then loaded into a Word document
and sorted into alphabetical order. (To print in a preferred random
order is somewhat more complicated and you would have to use a method
like that employed in my boiler add-in to assemble the files in order
before processing them - in fact I might create an add-in to do just
that if I have a few minutes spare)

The files listed in the document are then opened in the order they
are now presented, printed and closed.

Sub BatchPrint()
Dim strPath As String
Dim oDoc As Document, oPrDoc As Document
Dim oRng As Range
Dim i As Long, iNum As Long
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.title = "Select files to print and click OK"
.AllowMultiSelect = True
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User", , _
"Print Files"
Exit Sub
End If
End With
Set oDoc = Documents.Add
iNum = fDialog.SelectedItems.Count
For i = 1 To iNum
strPath = fDialog.SelectedItems.Item(i)
oDoc.Range.InsertAfter strPath
If i fDialog.SelectedItems.Count Then
oDoc.Range.InsertAfter vbCr
End If
Next i
oDoc.Range.Sort
For i = 1 To iNum
Set oRng = oDoc.Paragraphs(i).Range
oRng.End = oRng.End - 1
MsgBox oRng.Text
WordBasic.DisableAutoMacros 1
Set oPrDoc = Documents.Open(oRng.Text)
oPrDoc.PrintOut
oPrDoc.Close wdDoNotSaveChanges
WordBasic.DisableAutoMacros 0
Next i
End Sub
http://www.gmayor.com/installing_macro.htm


milo19 wrote:
I want to be able to highlight multiple Word 2007 documents and print
them in the order that they appear in the selection. Word will print
the files, but not in the correct order. How can I print many files
in the correct order?



  #4   Report Post  
Posted to microsoft.public.word.docmanagement
milo19 milo19 is offline
external usenet poster
 
Posts: 11
Default Print multiple files

Unfortunately, neither the zip file nor the macro worked correctly in
printing the documents in the specified order. The files print, but not
always in the order selected. Is there an additional setting that I have to
change somewhere?
--
Gina M


"Graham Mayor" wrote:

If you want to try it, I have posted the add-in on my web site at
http://www.gmayor.com/Zips/Word_Batch_Print.zip but the documentation will
have to wait until tomorrow. It is however fairly straightforward. If you
install the 2007 version, you will get a button on the developer tab of the
ribbon, which will activate a userform. Pick the files you want to print and
it will print them in the order they are listed.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Graham Mayor wrote:
This is a Windows issue. One way to overcome the problem is to beat
it with a blunt instrument. The following macro allows you to select
a list of files. The filenames are then loaded into a Word document
and sorted into alphabetical order. (To print in a preferred random
order is somewhat more complicated and you would have to use a method
like that employed in my boiler add-in to assemble the files in order
before processing them - in fact I might create an add-in to do just
that if I have a few minutes spare)

The files listed in the document are then opened in the order they
are now presented, printed and closed.

Sub BatchPrint()
Dim strPath As String
Dim oDoc As Document, oPrDoc As Document
Dim oRng As Range
Dim i As Long, iNum As Long
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.title = "Select files to print and click OK"
.AllowMultiSelect = True
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User", , _
"Print Files"
Exit Sub
End If
End With
Set oDoc = Documents.Add
iNum = fDialog.SelectedItems.Count
For i = 1 To iNum
strPath = fDialog.SelectedItems.Item(i)
oDoc.Range.InsertAfter strPath
If i fDialog.SelectedItems.Count Then
oDoc.Range.InsertAfter vbCr
End If
Next i
oDoc.Range.Sort
For i = 1 To iNum
Set oRng = oDoc.Paragraphs(i).Range
oRng.End = oRng.End - 1
MsgBox oRng.Text
WordBasic.DisableAutoMacros 1
Set oPrDoc = Documents.Open(oRng.Text)
oPrDoc.PrintOut
oPrDoc.Close wdDoNotSaveChanges
WordBasic.DisableAutoMacros 0
Next i
End Sub
http://www.gmayor.com/installing_macro.htm


milo19 wrote:
I want to be able to highlight multiple Word 2007 documents and print
them in the order that they appear in the selection. Word will print
the files, but not in the correct order. How can I print many files
in the correct order?




  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Print multiple files

Both the macro and the add-in open the documents in the selected order (the
macro in alphabetical order) and print them, just as if you had opened them
manually one at a time. I cannot think what mechanism is involved that would
make them change that order during the printing process. The add-in is now
documented on my web site - http://www.gmayor.com/Batch_Print.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




milo19 wrote:
Unfortunately, neither the zip file nor the macro worked correctly in
printing the documents in the specified order. The files print, but
not always in the order selected. Is there an additional setting
that I have to change somewhere?

If you want to try it, I have posted the add-in on my web site at
http://www.gmayor.com/Zips/Word_Batch_Print.zip but the
documentation will have to wait until tomorrow. It is however fairly
straightforward. If you install the 2007 version, you will get a
button on the developer tab of the ribbon, which will activate a
userform. Pick the files you want to print and it will print them in
the order they are listed.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Graham Mayor wrote:
This is a Windows issue. One way to overcome the problem is to beat
it with a blunt instrument. The following macro allows you to select
a list of files. The filenames are then loaded into a Word document
and sorted into alphabetical order. (To print in a preferred random
order is somewhat more complicated and you would have to use a
method like that employed in my boiler add-in to assemble the files
in order before processing them - in fact I might create an add-in
to do just that if I have a few minutes spare)

The files listed in the document are then opened in the order they
are now presented, printed and closed.

Sub BatchPrint()
Dim strPath As String
Dim oDoc As Document, oPrDoc As Document
Dim oRng As Range
Dim i As Long, iNum As Long
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.title = "Select files to print and click OK"
.AllowMultiSelect = True
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User", , _
"Print Files"
Exit Sub
End If
End With
Set oDoc = Documents.Add
iNum = fDialog.SelectedItems.Count
For i = 1 To iNum
strPath = fDialog.SelectedItems.Item(i)
oDoc.Range.InsertAfter strPath
If i fDialog.SelectedItems.Count Then
oDoc.Range.InsertAfter vbCr
End If
Next i
oDoc.Range.Sort
For i = 1 To iNum
Set oRng = oDoc.Paragraphs(i).Range
oRng.End = oRng.End - 1
MsgBox oRng.Text
WordBasic.DisableAutoMacros 1
Set oPrDoc = Documents.Open(oRng.Text)
oPrDoc.PrintOut
oPrDoc.Close wdDoNotSaveChanges
WordBasic.DisableAutoMacros 0
Next i
End Sub
http://www.gmayor.com/installing_macro.htm


milo19 wrote:
I want to be able to highlight multiple Word 2007 documents and
print them in the order that they appear in the selection. Word
will print the files, but not in the correct order. How can I
print many files in the correct order?





  #6   Report Post  
Posted to microsoft.public.word.docmanagement
milo19 milo19 is offline
external usenet poster
 
Posts: 11
Default Print multiple files

Thank you for your help, but I am back to where I started. The Add-In Batch
File Print macro does not print the files in the selected order. I (as well
as staff) tested this Add-In and most of the time it did not print the files
in the order specified. Sometimes it worked; but most of the time it did not
print in the selected order. I had a sample file called 1Test and another
file called 10Test. Even though 10Test was the selected as the last file to
be printed, it always printed first. We tried printing 25 memos (as one
example) in a specified order and again, it did not print in the correct
order. I spent over 2 hours testing this batch file and found it to be
inconsistent.
--
Gina M


"Graham Mayor" wrote:

Both the macro and the add-in open the documents in the selected order (the
macro in alphabetical order) and print them, just as if you had opened them
manually one at a time. I cannot think what mechanism is involved that would
make them change that order during the printing process. The add-in is now
documented on my web site - http://www.gmayor.com/Batch_Print.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




milo19 wrote:
Unfortunately, neither the zip file nor the macro worked correctly in
printing the documents in the specified order. The files print, but
not always in the order selected. Is there an additional setting
that I have to change somewhere?

If you want to try it, I have posted the add-in on my web site at
http://www.gmayor.com/Zips/Word_Batch_Print.zip but the
documentation will have to wait until tomorrow. It is however fairly
straightforward. If you install the 2007 version, you will get a
button on the developer tab of the ribbon, which will activate a
userform. Pick the files you want to print and it will print them in
the order they are listed.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Graham Mayor wrote:
This is a Windows issue. One way to overcome the problem is to beat
it with a blunt instrument. The following macro allows you to select
a list of files. The filenames are then loaded into a Word document
and sorted into alphabetical order. (To print in a preferred random
order is somewhat more complicated and you would have to use a
method like that employed in my boiler add-in to assemble the files
in order before processing them - in fact I might create an add-in
to do just that if I have a few minutes spare)

The files listed in the document are then opened in the order they
are now presented, printed and closed.

Sub BatchPrint()
Dim strPath As String
Dim oDoc As Document, oPrDoc As Document
Dim oRng As Range
Dim i As Long, iNum As Long
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.title = "Select files to print and click OK"
.AllowMultiSelect = True
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User", , _
"Print Files"
Exit Sub
End If
End With
Set oDoc = Documents.Add
iNum = fDialog.SelectedItems.Count
For i = 1 To iNum
strPath = fDialog.SelectedItems.Item(i)
oDoc.Range.InsertAfter strPath
If i fDialog.SelectedItems.Count Then
oDoc.Range.InsertAfter vbCr
End If
Next i
oDoc.Range.Sort
For i = 1 To iNum
Set oRng = oDoc.Paragraphs(i).Range
oRng.End = oRng.End - 1
MsgBox oRng.Text
WordBasic.DisableAutoMacros 1
Set oPrDoc = Documents.Open(oRng.Text)
oPrDoc.PrintOut
oPrDoc.Close wdDoNotSaveChanges
WordBasic.DisableAutoMacros 0
Next i
End Sub
http://www.gmayor.com/installing_macro.htm


milo19 wrote:
I want to be able to highlight multiple Word 2007 documents and
print them in the order that they appear in the selection. Word
will print the files, but not in the correct order. How can I
print many files in the correct order?




  #7   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Print multiple files

Oops! My fault. (
I had left a line of code from the original macro that the add-in was
supposed to correct and I had missed it when I tested it.
I have replaced the add-ins on the web site. They should now work as
described.
Apologies

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org





milo19 wrote:
Thank you for your help, but I am back to where I started. The
Add-In Batch File Print macro does not print the files in the
selected order. I (as well as staff) tested this Add-In and most of
the time it did not print the files in the order specified.
Sometimes it worked; but most of the time it did not print in the
selected order. I had a sample file called 1Test and another file
called 10Test. Even though 10Test was the selected as the last file
to be printed, it always printed first. We tried printing 25 memos
(as one example) in a specified order and again, it did not print in
the correct order. I spent over 2 hours testing this batch file and
found it to be inconsistent.

Both the macro and the add-in open the documents in the selected
order (the macro in alphabetical order) and print them, just as if
you had opened them manually one at a time. I cannot think what
mechanism is involved that would make them change that order during
the printing process. The add-in is now documented on my web site -
http://www.gmayor.com/Batch_Print.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




milo19 wrote:
Unfortunately, neither the zip file nor the macro worked correctly
in printing the documents in the specified order. The files print,
but not always in the order selected. Is there an additional
setting that I have to change somewhere?

If you want to try it, I have posted the add-in on my web site at
http://www.gmayor.com/Zips/Word_Batch_Print.zip but the
documentation will have to wait until tomorrow. It is however
fairly straightforward. If you install the 2007 version, you will
get a button on the developer tab of the ribbon, which will
activate a userform. Pick the files you want to print and it will
print them in the order they are listed.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Graham Mayor wrote:
This is a Windows issue. One way to overcome the problem is to
beat it with a blunt instrument. The following macro allows you
to select a list of files. The filenames are then loaded into a
Word document and sorted into alphabetical order. (To print in a
preferred random order is somewhat more complicated and you would
have to use a method like that employed in my boiler add-in to
assemble the files in order before processing them - in fact I
might create an add-in to do just that if I have a few minutes
spare)

The files listed in the document are then opened in the order they
are now presented, printed and closed.

Sub BatchPrint()
Dim strPath As String
Dim oDoc As Document, oPrDoc As Document
Dim oRng As Range
Dim i As Long, iNum As Long
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.title = "Select files to print and click OK"
.AllowMultiSelect = True
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User", , _
"Print Files"
Exit Sub
End If
End With
Set oDoc = Documents.Add
iNum = fDialog.SelectedItems.Count
For i = 1 To iNum
strPath = fDialog.SelectedItems.Item(i)
oDoc.Range.InsertAfter strPath
If i fDialog.SelectedItems.Count Then
oDoc.Range.InsertAfter vbCr
End If
Next i
oDoc.Range.Sort
For i = 1 To iNum
Set oRng = oDoc.Paragraphs(i).Range
oRng.End = oRng.End - 1
MsgBox oRng.Text
WordBasic.DisableAutoMacros 1
Set oPrDoc = Documents.Open(oRng.Text)
oPrDoc.PrintOut
oPrDoc.Close wdDoNotSaveChanges
WordBasic.DisableAutoMacros 0
Next i
End Sub
http://www.gmayor.com/installing_macro.htm


milo19 wrote:
I want to be able to highlight multiple Word 2007 documents and
print them in the order that they appear in the selection. Word
will print the files, but not in the correct order. How can I
print many files in the correct order?



  #8   Report Post  
Posted to microsoft.public.word.docmanagement
milo19 milo19 is offline
external usenet poster
 
Posts: 11
Default Print multiple files

Thank you for the fix! We are currently testing the macro again and so
far it is printing documents in the specified order as long as the Print in
Background setting is turned off.
--
Gina M


"Graham Mayor" wrote:

Oops! My fault. (
I had left a line of code from the original macro that the add-in was
supposed to correct and I had missed it when I tested it.
I have replaced the add-ins on the web site. They should now work as
described.
Apologies

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org





milo19 wrote:
Thank you for your help, but I am back to where I started. The
Add-In Batch File Print macro does not print the files in the
selected order. I (as well as staff) tested this Add-In and most of
the time it did not print the files in the order specified.
Sometimes it worked; but most of the time it did not print in the
selected order. I had a sample file called 1Test and another file
called 10Test. Even though 10Test was the selected as the last file
to be printed, it always printed first. We tried printing 25 memos
(as one example) in a specified order and again, it did not print in
the correct order. I spent over 2 hours testing this batch file and
found it to be inconsistent.

Both the macro and the add-in open the documents in the selected
order (the macro in alphabetical order) and print them, just as if
you had opened them manually one at a time. I cannot think what
mechanism is involved that would make them change that order during
the printing process. The add-in is now documented on my web site -
http://www.gmayor.com/Batch_Print.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




milo19 wrote:
Unfortunately, neither the zip file nor the macro worked correctly
in printing the documents in the specified order. The files print,
but not always in the order selected. Is there an additional
setting that I have to change somewhere?

If you want to try it, I have posted the add-in on my web site at
http://www.gmayor.com/Zips/Word_Batch_Print.zip but the
documentation will have to wait until tomorrow. It is however
fairly straightforward. If you install the 2007 version, you will
get a button on the developer tab of the ribbon, which will
activate a userform. Pick the files you want to print and it will
print them in the order they are listed.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Graham Mayor wrote:
This is a Windows issue. One way to overcome the problem is to
beat it with a blunt instrument. The following macro allows you
to select a list of files. The filenames are then loaded into a
Word document and sorted into alphabetical order. (To print in a
preferred random order is somewhat more complicated and you would
have to use a method like that employed in my boiler add-in to
assemble the files in order before processing them - in fact I
might create an add-in to do just that if I have a few minutes
spare)

The files listed in the document are then opened in the order they
are now presented, printed and closed.

Sub BatchPrint()
Dim strPath As String
Dim oDoc As Document, oPrDoc As Document
Dim oRng As Range
Dim i As Long, iNum As Long
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.title = "Select files to print and click OK"
.AllowMultiSelect = True
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User", , _
"Print Files"
Exit Sub
End If
End With
Set oDoc = Documents.Add
iNum = fDialog.SelectedItems.Count
For i = 1 To iNum
strPath = fDialog.SelectedItems.Item(i)
oDoc.Range.InsertAfter strPath
If i fDialog.SelectedItems.Count Then
oDoc.Range.InsertAfter vbCr
End If
Next i
oDoc.Range.Sort
For i = 1 To iNum
Set oRng = oDoc.Paragraphs(i).Range
oRng.End = oRng.End - 1
MsgBox oRng.Text
WordBasic.DisableAutoMacros 1
Set oPrDoc = Documents.Open(oRng.Text)
oPrDoc.PrintOut
oPrDoc.Close wdDoNotSaveChanges
WordBasic.DisableAutoMacros 0
Next i
End Sub
http://www.gmayor.com/installing_macro.htm


milo19 wrote:
I want to be able to highlight multiple Word 2007 documents and
print them in the order that they appear in the selection. Word
will print the files, but not in the correct order. How can I
print many files in the correct order?




  #9   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Print multiple files

I am not sure why that is necessary - as the macro should add the documents
to the print queue in order.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



milo19 wrote:
Thank you for the fix! We are currently testing the macro again
and so far it is printing documents in the specified order as long as
the Print in Background setting is turned off.

Oops! My fault. (
I had left a line of code from the original macro that the add-in was
supposed to correct and I had missed it when I tested it.
I have replaced the add-ins on the web site. They should now work as
described.
Apologies

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org





milo19 wrote:
Thank you for your help, but I am back to where I started. The
Add-In Batch File Print macro does not print the files in the
selected order. I (as well as staff) tested this Add-In and most of
the time it did not print the files in the order specified.
Sometimes it worked; but most of the time it did not print in the
selected order. I had a sample file called 1Test and another file
called 10Test. Even though 10Test was the selected as the last file
to be printed, it always printed first. We tried printing 25 memos
(as one example) in a specified order and again, it did not print in
the correct order. I spent over 2 hours testing this batch file and
found it to be inconsistent.

Both the macro and the add-in open the documents in the selected
order (the macro in alphabetical order) and print them, just as if
you had opened them manually one at a time. I cannot think what
mechanism is involved that would make them change that order during
the printing process. The add-in is now documented on my web site -
http://www.gmayor.com/Batch_Print.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




milo19 wrote:
Unfortunately, neither the zip file nor the macro worked correctly
in printing the documents in the specified order. The files
print, but not always in the order selected. Is there an
additional setting that I have to change somewhere?

If you want to try it, I have posted the add-in on my web site at
http://www.gmayor.com/Zips/Word_Batch_Print.zip but the
documentation will have to wait until tomorrow. It is however
fairly straightforward. If you install the 2007 version, you will
get a button on the developer tab of the ribbon, which will
activate a userform. Pick the files you want to print and it will
print them in the order they are listed.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Graham Mayor wrote:
This is a Windows issue. One way to overcome the problem is to
beat it with a blunt instrument. The following macro allows you
to select a list of files. The filenames are then loaded into a
Word document and sorted into alphabetical order. (To print in a
preferred random order is somewhat more complicated and you
would have to use a method like that employed in my boiler
add-in to assemble the files in order before processing them -
in fact I might create an add-in to do just that if I have a
few minutes spare)

The files listed in the document are then opened in the order
they are now presented, printed and closed.

Sub BatchPrint()
Dim strPath As String
Dim oDoc As Document, oPrDoc As Document
Dim oRng As Range
Dim i As Long, iNum As Long
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.title = "Select files to print and click OK"
.AllowMultiSelect = True
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User", , _
"Print Files"
Exit Sub
End If
End With
Set oDoc = Documents.Add
iNum = fDialog.SelectedItems.Count
For i = 1 To iNum
strPath = fDialog.SelectedItems.Item(i)
oDoc.Range.InsertAfter strPath
If i fDialog.SelectedItems.Count Then
oDoc.Range.InsertAfter vbCr
End If
Next i
oDoc.Range.Sort
For i = 1 To iNum
Set oRng = oDoc.Paragraphs(i).Range
oRng.End = oRng.End - 1
MsgBox oRng.Text
WordBasic.DisableAutoMacros 1
Set oPrDoc = Documents.Open(oRng.Text)
oPrDoc.PrintOut
oPrDoc.Close wdDoNotSaveChanges
WordBasic.DisableAutoMacros 0
Next i
End Sub
http://www.gmayor.com/installing_macro.htm


milo19 wrote:
I want to be able to highlight multiple Word 2007 documents and
print them in the order that they appear in the selection.
Word will print the files, but not in the correct order. How
can I print many files in the correct order?



  #10   Report Post  
Posted to microsoft.public.word.docmanagement
milo19 milo19 is offline
external usenet poster
 
Posts: 11
Default Print multiple files

We are selecting many documents (30-40) and for some reason the macro does
not print in the selected order unless the setting, Print in Background, is
turned off. We are still testing, but that is what we have found so far.
Thanks again for your help.
--
Gina M


"Graham Mayor" wrote:

I am not sure why that is necessary - as the macro should add the documents
to the print queue in order.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



milo19 wrote:
Thank you for the fix! We are currently testing the macro again
and so far it is printing documents in the specified order as long as
the Print in Background setting is turned off.

Oops! My fault. (
I had left a line of code from the original macro that the add-in was
supposed to correct and I had missed it when I tested it.
I have replaced the add-ins on the web site. They should now work as
described.
Apologies

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org





milo19 wrote:
Thank you for your help, but I am back to where I started. The
Add-In Batch File Print macro does not print the files in the
selected order. I (as well as staff) tested this Add-In and most of
the time it did not print the files in the order specified.
Sometimes it worked; but most of the time it did not print in the
selected order. I had a sample file called 1Test and another file
called 10Test. Even though 10Test was the selected as the last file
to be printed, it always printed first. We tried printing 25 memos
(as one example) in a specified order and again, it did not print in
the correct order. I spent over 2 hours testing this batch file and
found it to be inconsistent.

Both the macro and the add-in open the documents in the selected
order (the macro in alphabetical order) and print them, just as if
you had opened them manually one at a time. I cannot think what
mechanism is involved that would make them change that order during
the printing process. The add-in is now documented on my web site -
http://www.gmayor.com/Batch_Print.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




milo19 wrote:
Unfortunately, neither the zip file nor the macro worked correctly
in printing the documents in the specified order. The files
print, but not always in the order selected. Is there an
additional setting that I have to change somewhere?

If you want to try it, I have posted the add-in on my web site at
http://www.gmayor.com/Zips/Word_Batch_Print.zip but the
documentation will have to wait until tomorrow. It is however
fairly straightforward. If you install the 2007 version, you will
get a button on the developer tab of the ribbon, which will
activate a userform. Pick the files you want to print and it will
print them in the order they are listed.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Graham Mayor wrote:
This is a Windows issue. One way to overcome the problem is to
beat it with a blunt instrument. The following macro allows you
to select a list of files. The filenames are then loaded into a
Word document and sorted into alphabetical order. (To print in a
preferred random order is somewhat more complicated and you
would have to use a method like that employed in my boiler
add-in to assemble the files in order before processing them -
in fact I might create an add-in to do just that if I have a
few minutes spare)

The files listed in the document are then opened in the order
they are now presented, printed and closed.

Sub BatchPrint()
Dim strPath As String
Dim oDoc As Document, oPrDoc As Document
Dim oRng As Range
Dim i As Long, iNum As Long
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.title = "Select files to print and click OK"
.AllowMultiSelect = True
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User", , _
"Print Files"
Exit Sub
End If
End With
Set oDoc = Documents.Add
iNum = fDialog.SelectedItems.Count
For i = 1 To iNum
strPath = fDialog.SelectedItems.Item(i)
oDoc.Range.InsertAfter strPath
If i fDialog.SelectedItems.Count Then
oDoc.Range.InsertAfter vbCr
End If
Next i
oDoc.Range.Sort
For i = 1 To iNum
Set oRng = oDoc.Paragraphs(i).Range
oRng.End = oRng.End - 1
MsgBox oRng.Text
WordBasic.DisableAutoMacros 1
Set oPrDoc = Documents.Open(oRng.Text)
oPrDoc.PrintOut
oPrDoc.Close wdDoNotSaveChanges
WordBasic.DisableAutoMacros 0
Next i
End Sub
http://www.gmayor.com/installing_macro.htm


milo19 wrote:
I want to be able to highlight multiple Word 2007 documents and
print them in the order that they appear in the selection.
Word will print the files, but not in the correct order. How
can I print many files in the correct order?






  #11   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Print multiple files

The relevant part of the add-in is as follows. I suspect that the document
may be being closed before it has finished spooling. If you disable the
lines
oPrDoc.PrintOut
and
oPrDoc.Close wdDoNotSaveChanges
by adding an apostrophe to the start of each line and run the macro, you
should end up with a document (oDoc) that contains the list of documents in
the order they are to be printed.

If that is OK then try introducing a delay eg

For i = 1 To 500000000
Next i

between
oPrDoc.PrintOut
oPrDoc.Close wdDoNotSaveChanges
thus

oPrDoc.PrintOut

For i = 1 To 500000000
Next i
oPrDoc.Close wdDoNotSaveChanges

Which will add a delay of around 10 seconds (depending on the speed of your
PC) - much shorter than the print cycle, but may give sufficient delay to
ensure that the document is spooled correctly.

Private Sub CommandButton1_click()
Unload Me
For i = 0 To ListBox2.ListCount - 1
strPath = sBatchFolder & ListBox2.List(i)
oDoc.Range.InsertAfter strPath
If i ListBox2.ListCount - 1 Then
oDoc.Range.InsertAfter vbCr
End If
Next i
Application.ScreenUpdating = False
For i = 1 To oDoc.Paragraphs.Count
Set oRng = oDoc.Paragraphs(i).Range
oRng.End = oRng.End - 1
WordBasic.DisableAutoMacros 1
'************************************
Set oPrDoc = Documents.Open(oRng.Text)
oPrDoc.PrintOut
oPrDoc.Close wdDoNotSaveChanges
'************************************
WordBasic.DisableAutoMacros 0
Next i
oDoc.Close wdDoNotSaveChanges
Application.ScreenUpdating = True
End Sub

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


milo19 wrote:
We are selecting many documents (30-40) and for some reason the macro
does not print in the selected order unless the setting, Print in
Background, is turned off. We are still testing, but that is what we
have found so far. Thanks again for your help.

I am not sure why that is necessary - as the macro should add the
documents to the print queue in order.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



milo19 wrote:
Thank you for the fix! We are currently testing the macro again
and so far it is printing documents in the specified order as long
as the Print in Background setting is turned off.

Oops! My fault. (
I had left a line of code from the original macro that the add-in
was supposed to correct and I had missed it when I tested it.
I have replaced the add-ins on the web site. They should now work
as described.
Apologies

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org





milo19 wrote:
Thank you for your help, but I am back to where I started. The
Add-In Batch File Print macro does not print the files in the
selected order. I (as well as staff) tested this Add-In and most
of the time it did not print the files in the order specified.
Sometimes it worked; but most of the time it did not print in the
selected order. I had a sample file called 1Test and another file
called 10Test. Even though 10Test was the selected as the last
file to be printed, it always printed first. We tried printing
25 memos (as one example) in a specified order and again, it did
not print in the correct order. I spent over 2 hours testing
this batch file and found it to be inconsistent.

Both the macro and the add-in open the documents in the selected
order (the macro in alphabetical order) and print them, just as
if you had opened them manually one at a time. I cannot think
what mechanism is involved that would make them change that
order during the printing process. The add-in is now documented
on my web site - http://www.gmayor.com/Batch_Print.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




milo19 wrote:
Unfortunately, neither the zip file nor the macro worked
correctly in printing the documents in the specified order.
The files print, but not always in the order selected. Is
there an additional setting that I have to change somewhere?

If you want to try it, I have posted the add-in on my web site
at http://www.gmayor.com/Zips/Word_Batch_Print.zip but the
documentation will have to wait until tomorrow. It is however
fairly straightforward. If you install the 2007 version, you
will get a button on the developer tab of the ribbon, which
will activate a userform. Pick the files you want to print and
it will print them in the order they are listed.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Graham Mayor wrote:
This is a Windows issue. One way to overcome the problem is to
beat it with a blunt instrument. The following macro allows
you to select a list of files. The filenames are then loaded
into a Word document and sorted into alphabetical order. (To
print in a preferred random order is somewhat more
complicated and you would have to use a method like that
employed in my boiler add-in to assemble the files in order
before processing them - in fact I might create an add-in to
do just that if I have a few minutes spare)

The files listed in the document are then opened in the order
they are now presented, printed and closed.

Sub BatchPrint()
Dim strPath As String
Dim oDoc As Document, oPrDoc As Document
Dim oRng As Range
Dim i As Long, iNum As Long
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
.title = "Select files to print and click OK"
.AllowMultiSelect = True
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User", , _
"Print Files"
Exit Sub
End If
End With
Set oDoc = Documents.Add
iNum = fDialog.SelectedItems.Count
For i = 1 To iNum
strPath = fDialog.SelectedItems.Item(i)
oDoc.Range.InsertAfter strPath
If i fDialog.SelectedItems.Count Then
oDoc.Range.InsertAfter vbCr
End If
Next i
oDoc.Range.Sort
For i = 1 To iNum
Set oRng = oDoc.Paragraphs(i).Range
oRng.End = oRng.End - 1
MsgBox oRng.Text
WordBasic.DisableAutoMacros 1
Set oPrDoc = Documents.Open(oRng.Text)
oPrDoc.PrintOut
oPrDoc.Close wdDoNotSaveChanges
WordBasic.DisableAutoMacros 0
Next i
End Sub
http://www.gmayor.com/installing_macro.htm


milo19 wrote:
I want to be able to highlight multiple Word 2007 documents
and print them in the order that they appear in the
selection. Word will print the files, but not in the correct
order. How can I print many files in the correct order?



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically add image to multiple files in multiple folders Hilary Microsoft Word Help 4 July 19th 08 06:02 AM
Print multiple word files in one file Luca Microsoft Word Help 4 September 14th 07 10:51 AM
Can I print just the first page from multiple files all at once? Seawolf Microsoft Word Help 3 January 2nd 07 04:41 PM
How do I print a booklet using multiple Word files? dr-art Microsoft Word Help 2 February 10th 06 10:02 PM
How to print booklet (MS Word 2003) using multiple files. dr-art Microsoft Word Help 2 February 10th 06 06:05 PM


All times are GMT +1. The time now is 11:14 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"