Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6612537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:06:37+00:00 2026-05-25T20:06:37+00:00

I have an old ruby program that extracts values from an excel file and

  • 0

I have an old ruby program that extracts values from an excel file and stores the summary in another excel file. For that purpose, the program uses the library win32ole from Ruby. After switching to a new computer with Windows 7 64bit (instead of Windows XP 32bit), Office 2007 instead of Office 2003, the program now throws an error when storing the resulting excel file:

ana.rb:120:in `method_missing': SaveAs (WIN32OLERuntimeError)
  OLE error code:800A03EC in Microsoft Office Excel
    'c:/my/dir' could not be accessed. The file could be corrupt, is on a server that does not react, or the file is write protected.
    (German: Auf 'c:/my/dir' konnte nicht zugegriffen werden. Unter Umstaenden ist die Datei beschaedigt, befindet sich auf einem Server, der nicht mehr reagiert, oder die Datei ist schreibgeschuzetzt.)
HRESULT error code:0x80020009
  Ausnahmefehler aufgetreten.
    from ana.rb:120:in `save'
    from ana.rb:54:in `generateReport'
    from ana.rb:13:in `ana'
    from ana.rb:191

The relevant parts of the program are:

def generateReport
  ...
  report.save(basicdir + reportfile)
  ...
end

with the report:

class EasyExcel
  def initialize(path)
    @path = path
    @excel = excel = WIN32OLE.new("excel.application")
    @workbook = @excel.Application.Workbooks.Open(@path)
    @cache = Array.new
  end
  def save(filename)
    saveCache
    @workbook.SaveAs(filename)
  end

The line 120 is that @workbook.SaveAs(filename). The value of filename at that moment is c:/projekte/itcampus/feedback-analyse/feedback_report.xls. After some debugging, I have noticed that due to my bad ruby exception handling, after the stop of the ruby interpreter, there are 2 instances of excel hanging. So it seems the problem is really due to the changes in handling paths in Excel on Windows 7.

Does any one know the answers to the following questions:

  • What could be the reason for the failure: 64bit instead of 32bit, using Office 2007 instead of 2003, or both?
  • Is there a workaround or fix to use a bridge to Windows 7 64bit and applications like Word or Excel from Ruby?
  • How can I find which API is available from a windows application from Ruby?

The Ruby interpreter I have tried are:

  • ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32]
  • ruby 1.9.2p180 (2011-02-18) [i386-mingw32]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:06:38+00:00Added an answer on May 25, 2026 at 8:06 pm

    Thank’s to all who added ideas and comments to my question. Finally, I found a workaround.

    class EasyExcel
      ....
      def save(filename)
        saveCache
        dos_file = filename.gsub(/\//, "\\\\")
        @workbook.SaveAs(filename)
      end
    

    This replaces in the (ruby) path every forward slash with 2 backward slashes, which then will evaluated to 1 backward slash at the end.

    So opening an excel with

    @workbook = @excel.Application.Workbooks.Open(@path)
    

    (with @path something like

    C:/projekte/itcampus/feedback-analyse/feedback/Bewertungsbogen_XX1404.xls
    

    ) works, but

    @workbook.SaveAs("c:/projekte/itcampus/feedback-analyse/feedback_report.xls")
    

    does not. Very strange!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have old code that uses size_t which IIRC comes from cstring.h. On OS
I have an old .dot file with a few dozen styles in it. I
I have a old website that generate its own RSS everytime a new post
I have several old 3.5in floppy disks that I would like to backup. My
I Have an old vbs script file being kicked off by an AutoSys job.
I have an old website that hasn't gotten much love over the years and
I have an old databasefile from an application written in Delphi. My task is
We have cloud-hosted (RackSpace cloud) Ruby and Java apps that will interact as follows:
I am having a problem getting an old Ruby on Rails 2 app that
I have migrated a old php/mysql site to ruby on rails, and had to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.