OLE没有注册ClassFactory

时间:2019-12-17 09:09:45

标签: ruby windows ole win32ole

我正在维护一个红宝石应用程序。 ruby安装程序打包到ThinApp中。 Ruby代码位于网络共享上。  现在OLE和excel出现了问题。

这是产生错误的示例代码。

require 'win32ole'

puts 'Starting Test'
excel = WIN32OLE.new('excel.application')

错误的错误消息:

test.rb:4:in initialize: failed to create WIN32OLE object from `excel.application' (WIN32OLERuntimeError)  
    HRESULT error code:0x800401fe  
      Applicaiton has been started, but there is no ClassFactory registered.  
        from Z:/ruby test/test.rb:4:in `new'  
        from Z:/ruby test/test.rb:4:in `<main>'  

如果我尝试WIN32OLE.new('word.application'),我的代码将正常运行。
如果已经启动excel,WIN32OLE.connect('excel.application')也可以使用。

有人知道这个问题是什么原因吗?

感谢您的帮助

0 个答案:

没有答案