From: iMelody Ooo Date: 2010-09-24T22:45:53+09:00 Subject: Re: How to open file dialog in Ruby, and get open FileName? :-( I find an example from http://www.java2s.com , but pop error: main.rb:21:in `initialize': failed to create WIN32OLE object from `MSComDlg.CommonDialog' (WIN32OLERuntimeError) HRESULT error code:0x80040112 cd = WIN32OLE.new("MSComDlg.CommonDialog") cd.filter = "All Files(*.*)|*.*" +"|Ruby Files(*.rb)|*.rb" cd.filterIndex = 2 cd.maxFileSize = 128 # Set MaxFileSize cd.showOpen() file = cd.fileName # Retrieve file, path if not file or file=="" puts "No filename entered." else puts "The user selected: #{file}\n" end -- Posted via http://www.ruby-forum.com/.