Thanks, BUT i get same error, I changed the 2nd line to

excel = WIN32OLE::new('excel.application')
On Thu, Jul 8, 2010 at 5:09 PM, SMF SMF <[email protected]> wrote:

> Change 2nd line to as below-
>
> excel = WIN32OLE::new('excel.application')
>
>   On Thu, Jul 8, 2010 at 5:00 PM, Shiv <[email protected]> wrote:
>
>>   Hello,
>>
>> I am trying to open a excel file and write data, but i m getting runtime
>> error
>>  I checked the path is correct
>> new method works fine but open method throws error...can u pls help me
>> figure out this problem
>>
>> *Code:*
>> require 'win32ole'
>> excel = WIN32OLE.new('excel.application')
>> excel.visible = true
>> excel.Workbooks.Open('D:\shiv.xls')
>> excel.range('A1').value = 'Hello, world.'
>> excel.Close
>> excel.Quit
>>
>>
>> *Error:*
>> C:\Ruby\bin>ruby C:\Ruby_Scripts\Ex_open.rb
>> C:/Ruby_Scripts/Ex_open.rb:6:in `method_missing': Open
>> (WIN32OLERuntimeError)
>>     OLE error code:800A03EC in Microsoft Office Excel
>>       'D:\shiv.xls' could not be found. Check the spelling of the file
>> name, and
>>  verify that the file location is correct.
>> If you are trying to open the file from your list of most recently used
>> files, m
>> ake sure that the file has not been renamed, moved, or deleted.
>>     HRESULT error code:0x80020009
>>       Exception occurred.
>>         from C:/Ruby_Scripts/Ex_open.rb:6
>>
>> Regards,
>> Shiv
>>
>> --
>> Before posting, please read http://watir.com/support. In short: search
>> before you ask, be nice.
>>
>> You received this message because you are subscribed to
>> http://groups.google.com/group/watir-general
>> To post: [email protected]
>> To unsubscribe: 
>> [email protected]<watir-general%[email protected]>
>>
>
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> You received this message because you are subscribed to
> http://groups.google.com/group/watir-general
> To post: [email protected]
> To unsubscribe: 
> [email protected]<watir-general%[email protected]>
>

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: [email protected]
To unsubscribe: [email protected]

Reply via email to