mikeruddell2 Posted October 14, 2010 Posted October 14, 2010 We have all our reports stored on a network drive that have been created by SIMS, but they are in XML format. If we want to print 30 of them in one go (all from one folder) the only solution I have is to do file > open in word 2007 and then click tools and print (once the files are selected) This seems to print them in a really random order and I want them to be alphabetical when they come off the printer. Any suggestions? Mike
vikpaw Posted October 14, 2010 Posted October 14, 2010 I used to have a vbs script that printed a whole folder of files, it would invoke the application and print, but i don't think that works anymore. I still have 2 scripts for renaming the files which is all you need to do in order to fool the system into letting you print them. 1 to rename a folder of .xml files to .doc and the other to undo the process. It's best to undo, otherwise you could run in to issues with programs on other computers not liking the file type or security programs warning of the contents not being of the right type. Have a go and see if it works. You need to provide the full path to the folder where the files live. There was also a way to hack the registry on XP and add a print option to the right click context menu, but i never found the notes for that. This lets you do the same, once you've renamed. XML2DOC.zip 1
mikeruddell2 Posted October 14, 2010 Author Posted October 14, 2010 Well, the problem actually being that when I select them all in the word file open dialog and use the tools>print option, it does them in a really random order. I can batch print them all, but really need them to come out of the printer in alphabetical order (which I'd assumed they would as the filenames were listed alphabetically.... Thanks for your reply, though.
vikpaw Posted October 14, 2010 Posted October 14, 2010 (edited) If you batch print from a folder they come out in order. Using the right click print method. Well they print down the list starting from the one you clicked on. So if you start at the top... EDIT: more specifically though, for your issue, is the dialog box in Detail view? I think it would matter and you'd want the top file to be active when you choose print. I've never batch printed straight from Word, the folder method was easier for us. Edited October 14, 2010 by vikpaw addition
browolf Posted October 14, 2010 Posted October 14, 2010 maybe a script to rename the files would be more useful...?
ChrisH Posted October 14, 2010 Posted October 14, 2010 I have a macro that merges all the files into one document and I then print it from there. I do it this way for mass editing and checking. I have another one that inserts a page between them all as well (usually a key to grades etc). If you are interested I will post it up. I am sure there is an older version on here already as well.
ChrisH Posted October 14, 2010 Posted October 14, 2010 maybe a script to rename the files would be more useful...? This can be an annoyance sometime. I use a bulk renaming tool with a few regular expressions to sort this. Typical situation is it outputs everything with the teachers initials first and I want them to be grouped in subjects, so I get the subject name to the front and the initials to the end.
mikeruddell2 Posted October 15, 2010 Author Posted October 15, 2010 I have a macro that merges all the files into one document and I then print it from there. I do it this way for mass editing and checking. I have another one that inserts a page between them all as well (usually a key to grades etc). If you are interested I will post it up. I am sure there is an older version on here already as well. Chris, I would be very interested to give this a go, could you email it to me at [email protected]? Thanks
resin1 Posted October 15, 2010 Posted October 15, 2010 Sounds really odd Mike. I've used the approach you are trying without issue for the last couple of years, countless times, and provided when you browse to select the files to print, they are being displayed in alphabetical sort order in the Windows browser, there surely shouldn't be anything to prevent that being the way they are worked through, should it? I simply drag to select all files in a folder, and if they are generated reports from SIMS named in the conventional way with Surname-Forename-etc-etc, they are normally displayed in Surname sort order and print exactly the same way. Does the same thing happen for a random group of Word documents saved as .xml that haven't been created from SIMS?
vikpaw Posted October 16, 2010 Posted October 16, 2010 @chrish; - please post the scripts for both file merge and the interleave option, i'm sure i can find a use for it.
newpersn Posted November 11, 2010 Posted November 11, 2010 didnt work. but i hope its just a setting on the file to do with permissions. Will test again later on. Sorry to dig an old post up.
ChrisH Posted November 11, 2010 Posted November 11, 2010 Sorry I seemed to miss the replies to this: This first one does the merge and puts a sheet on the back. It saves it one level up from the folder the files reside in and calls it the folder name plus whatever you put at the end of this line: strFileLocation = strLocations(X) + " Form Tutor Copy" In my case I have all the folders named the same as the class/form. The following line is where you define the back page: rng.InsertFile "Z:\Assesment\Letter Head\YR7 First Interim Report Key.doc" It could do with a little cleaning up with some constants etc but it works. It can add the odd blank page so you just quickly go through and delete them. I run this on Office 2003 at the moment because when I run it on Office 2007 it puts double spacing on all the table and text for some reason. Sub MergeAllDocsWithKey() Dim rng As Range Dim headerDoc As Document Dim MainDoc As Document Dim TempDoc As Document Dim strFile As String Dim sec As Section Dim strLocations(6) As String Dim strFileLocation As String Dim PageCounter As Integer Dim X As Integer PageCounter = 1 strLocations(1) = "X:\SIMS Reports\2010-2011\YR7 IPDC\Autumn Term\A" strLocations(2) = "X:\SIMS Reports\2010-2011\YR7 IPDC\Autumn Term\C" strLocations(3) = "X:\SIMS Reports\2010-2011\YR7 IPDC\Autumn Term\F" strLocations(4) = "X:\SIMS Reports\2010-2011\YR7 IPDC\Autumn Term\M" strLocations(5) = "X:\SIMS Reports\2010-2011\YR7 IPDC\Autumn Term\S" strLocations(6) = "X:\SIMS Reports\2010-2011\YR7 IPDC\Autumn Term\W" For X = 1 To UBound(strLocations) strFileLocation = "" strFolder = strLocations(X) + "\" 'change to suit Set MainDoc = Documents.Add strFile = Dir$(strFolder & "*.xml") Do Until strFile = "" ' Go to the end of the DOC Set rng = MainDoc.Bookmarks("\EndOfDoc").Range If rng.End > 0 Then 'rng.InsertBreak wdSectionBreakNextPage ' Go to the end of the DOC Set rng = MainDoc.Bookmarks("\EndOfDoc").Range End If 'Insert the Interim Report rng.InsertFile strFolder & strFile 'Get Next file strFile = Dir$() ' Go to the end of the DOC Set rng = MainDoc.Bookmarks("\EndOfDoc").Range rng.InsertBreak wdSectionBreakNextPage rng.InsertFile "Z:\Assesment\Letter Head\YR7 First Interim Report Key.doc" ' Go to the end of the DOC Set rng = MainDoc.Bookmarks("\EndOfDoc").Range ' Insert Page break Set rng = MainDoc.Bookmarks("\EndOfDoc").Range PageCounter = PageCounter + 1 Loop strFileLocation = strLocations(X) + " Form Tutor Copy" ' ColourSubjectCells ActiveDocument.SaveAs FileName:=strFileLocation, FileFormat:=wdFormatDocument ActiveDocument.Close SaveChanges:=False Next X End Sub If you don't want the back page then you just comment out a few lines.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now