From: "Hal E. Fulton" Date: 2001-04-13T12:48:33+09:00 Subject: [ruby-talk:13634] A bit of Win32OLE code for you Hello all, I've done a bit of playing with win32ole and thought I would share a little piece of code with you. This opens a file dialog onto your "My Documents" folder and lets you select a document for MS Word to print (which it then does). Cheers, Hal require "win32ole" Dir.chdir "C:\\My Documents" dlg = WIN32OLE.new("MSComDlg.CommonDialog"); # Set file filter dlg.filter = "Word documents (*.doc)|*.doc" + "|All Files(*.*)|*.*" dlg.filterIndex = 1 # Set MaxFileSize dlg.maxFileSize = 128 file = "" dlg.showOpen() # Retrieve file + path file = dlg.fileName exit if file == "" # Have a filename now... word = WIN32OLE.new "Word.Application" word.visible = false # Open the desired file word.documents.open file word.options.printBackground = false word.activeDocument.printOut word.quit