Join 3,512 readers in helping fund MetaFilter (Hide)


How can I make a Distiller-like program for Office 2007?
July 26, 2007 3:35 AM   Subscribe

I want to set up a system where Windows will watch a folder for any Office 2007 files and then automatically convert them into Office 2003/2004 files.

I'm a Mac admin for a small office. We use Office 2004. People here are being given Office 2007 format (docx, xlsx, pptx) files from outside PC users. Office 2004 cannot read 2007 files natively and the converter that the Microsoft Mac people handed out kinda blows (it wont even touch Excel files).

I want to set up a system that does what Adobe Acrobat Distiller does but with Office files. Where anyone can drop off a 2007 file on to a shared folder, and every x minutes Windows will check up on this folder and open up its respective application and covert them to the older format.

Is there a product that will do this for me? Is QuickKeys a good idea?

Can I automate all this? I know my way around Mac scripting but on Windows i'm a total n00b. But I would at least like to know if it's possible and what to start learning. How do you automate things in Windows Explorer and Office?
posted by sammich to Computers & Internet (4 answers total)
 
Well, it would be possible but cumbersome to do this with Office macros and Windows Script Host. I'll drop by later and give you more details if no one else has any better ideas.
posted by zixyer at 3:44 AM on July 26, 2007


Once upon a time, I trialled IntelliAdmin which had some sort of 2007-->2003 functionality, though I can't recall exactly what it did. It also costs money.

And if it makes you feel any better, the MS Windows converter isn't all that hot, either.
posted by jmd82 at 7:06 AM on July 26, 2007


This should be doable using AutoIT scripting. Run through the tutorials and the examples posted in the forums for more info. You will need a computer with an office 2007 install that does nothing but run this script 24/7.
posted by damn dirty ape at 7:09 AM on July 26, 2007


AutoIT might work well for this, but I get the impression that it's more intended for scripting Windows programs that aren't really set up to be scripted, which isn't the case for Office.

I wrote a little vbs script to show you how this might work. I only implemented .docx conversion; converting files from other Office programs would be done in a similar way. It iterates through all the files in a specified directory, deciding based on the file extension what program to use to convert them. You would save this script with a .vbs extension and schedule it to run every few minutes.
Const wdAlertsNone = 0, wdFormatDocument97 = 0

Set FS = CreateObject("Scripting.FileSystemObject")
Set Folder = FS.GetFolder("\\whereever\Conversion directory")

For Each File In Folder.Files
Extension = Mid(File.Name, InStrRev(File.Name, ".") + 1)
Select Case Extension
Case "docx"
Set Word = CreateObject("Word.Application")
Word.DisplayAlerts = wdAlertsNone
Word.Visible = True

Set Document = Word.Documents.Open(File.Path, False, True)
Document.SaveAs File.Path & ".doc", wdFormatDocument97

Word.Quit False
Set Word = Nothing
End Select
Next
The main problem with this approach is that scripting Office like this is inherently fragile. It's not really intended to be run in an unmonitored environment. For example, if the script is trying to save to the file "whatever.docx.doc" and someone has that file open (and thus locked for editing), Word will pop up a dialog box and stop your script. Be prepared to do a lot of testing and babysitting while you get this working.

Here are some links to documentation for the stuff I used: If you use any named constants in your code, you need to define them in the script (like I did for wdAlertsNone and wdFormatDocument97). This is a limitation of VBScript. Also, you can't use named parameters when calling methods.

I'm not really too certain that your approach is the best way for this problem. Perhaps it would be better if you set up an email account that users would send their files for conversion to -- it would then automatically send back the converted files. This would help solve some of the file locking issues, and there would be as much of a delay while waiting for the script to get around to its next iteration.

Let me know if you have any questions.
posted by zixyer at 9:54 PM on July 26, 2007


« Older Are there any 'famous' last.fm...   |  Where can I find a thin-fittin... Newer »
This thread is closed to new comments.