THANK YOU MARK

Works a treat

Now excuse my ignorance but why does <<sheet = application>> work but
<<sheet = application.activesheet>> not work? My experience with
Applescript suggests I was in the wrong object but the ruby objects
still confuse me a little 

Malcolm Beaton


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Cain, Mark
Sent: 04 January 2006 18:05
To: [email protected]
Subject: Re: [Wtr-general] selecting cells in Excell using activecell

This you might find helpful http://rubygarden.org/ruby?ScriptingExcel 

Also, I was playing around with your script and this worked for me:

sheet = application
sheet.activecell.offset(1,0).activate

--Mark

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Beaton, Malcolm
Sent: Wednesday, January 04, 2006 9:15 AM
To: [email protected]
Subject: [Wtr-general] selecting cells in Excell using activecell


Maybe a little out of scope for this group but I am trying to write and
retrieve cell data from Excel iteratively with ruby using the activecell
property. Only problem is it does not seem to work.

My script is basically

require 'win32ole'
application = WIN32OLE.new('Excel.Application')

application.visible = TRUE
workbook = application.Workbooks.Add();
worksheet = workbook.Worksheets(1);
(1..4).each do |x|
dirArray = ['North','South','East','West']
worksheet.Range('A' + (x.to_s)).value = dirArray[(x-1)]
end

sheet = application.activesheet
sheet.activecell.offset(1,0).activate

and I always get the error 
excell.rb:47:in `method_missing': Unknown property or method
`activecell' (WIN32OLERuntimeError)

Am I missing a lib or something? I can find no reference to other people
having this issue

Any help would be appreciated

Malcolm Beaton

_____________________________________________________________________
This e-mail has been scanned for viruses by MessageLabs. The information
contained in this message is confidential and is intended for the
addressee only. If you have received this message in error, please
notify Conchango plc as soon as possible. The unauthorised use,
disclosure, copying or alteration of this message is prohibited and may
be unlawful. The internet cannot guarantee the integrity of this message
and therefore Conchango plc will not be liable for the message if
modified.  

Reg. Heritage House, Church Road, Egham, Surrey, TW20 9QD T 44 (0) 1784
222 222 F 44 (0) 1784 222 200 E [EMAIL PROTECTED]  No. 2598884

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

_____________________________________________________________________
This e-mail has been scanned for viruses by MessageLabs. The information 
contained in this message is confidential and is intended for the addressee 
only. If you have received this message in error, please notify Conchango plc 
as soon as possible. The unauthorised use, disclosure, copying or alteration of 
this message is prohibited and may be unlawful. The internet cannot guarantee 
the integrity of this message and therefore Conchango plc will not be liable 
for the message if modified.  

Reg. Heritage House, Church Road, Egham, Surrey, TW20 9QD T 44 (0) 1784 222 222 
F 44 (0) 1784 222 200 E [EMAIL PROTECTED]  No. 2598884

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to