Forum: Ruby win32ole question....

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
72eb393f96912d674e0f5c1fb1111ba0?d=identicon&s=25 Dave Rose (bitsmith)
on 2007-02-01 22:08
can anybody point me to a good web page or know how to:
using ruby's WIN32OLE  'save as' a current
Worksheet into a csv format by only using
ruby's WIN32OLE access?
97550977337c9f0a0e1a9553e55bfaa0?d=identicon&s=25 Jan Svitok (Guest)
on 2007-02-02 00:24
(Received via mailing list)
On 2/1/07, Dave Rose <bitdoger2@yahoo.com> wrote:
> can anybody point me to a good web page or know how to:
> using ruby's WIN32OLE  'save as' a current
> Worksheet into a csv format by only using
> ruby's WIN32OLE access?

I'd try this: (I'm assuming that you want to work with excel)

1. record a macro doing the desired action (i.e. start recording
macro, save the worksheet as csv file and stop recording).

2. open VBA editor to see the source code of the macro

3. translate it into ruby/WIN32OLE

For the last step, you'll need to pick up only part of the macro -
there'll be probably other commands that you don't need. Look the
commands in the help or on MSDN to see what they do. For the Ruby
part, there's a chapter on this in Programming Ruby
(http://ruby-doc.org/docs/ProgrammingRuby/html/win32.html). You can
search the archive of the list for more info (Li Chen was a guy that
worked a lot with Excel, so look up his threads)
Bfa670ef2303deb7dec5a8027367b30b?d=identicon&s=25 David Mullet (mully)
on 2007-02-02 03:45
(Received via mailing list)
On Feb 1, 4:08 pm, Dave Rose <bitdog...@yahoo.com> wrote:
> can anybody point me to a good web page or know how to:
> using ruby's WIN32OLE  'save as' a current
> Worksheet into a csv format by only using
> ruby's WIN32OLE access?
>
> --
> Posted viahttp://www.ruby-forum.com/.

workbook.SaveAs 'myfile.csv', xlCSV

...where xlCSV = 6.

http://www.rubygarden.org:3000/Ruby/page/show/ScriptingExcel

Mully
72eb393f96912d674e0f5c1fb1111ba0?d=identicon&s=25 Dave Rose (bitsmith)
on 2007-02-02 17:20
David Mullet wrote:
> On Feb 1, 4:08 pm, Dave Rose <bitdog...@yahoo.com> wrote:
>> can anybody point me to a good web page or know how to:
>> using ruby's WIN32OLE  'save as' a current
>> Worksheet into a csv format by only using
>> ruby's WIN32OLE access?
>>
>> --
>> Posted viahttp://www.ruby-forum.com/.
>
> workbook.SaveAs 'myfile.csv', xlCSV
>
> ...where xlCSV = 6.
>
> http://www.rubygarden.org:3000/Ruby/page/show/ScriptingExcel
>
> Mully

thanx...fyi...it's a combo of both of your response...i did a macro and
used your's above to get...
excel.ActiveWorkbook.SaveAs("c:\\augcsv\\myfile1.csv", xlCSV)
...where xlCSV = 6.
...dave
Feee221f9eb7818d90625ea141bfd60c?d=identicon&s=25 bbiker (Guest)
on 2007-02-03 01:30
(Received via mailing list)
On Feb 2, 11:20 am, Dave Rose <bitdog...@yahoo.com> wrote:
> > workbook.SaveAs 'myfile.csv', xlCSV
> ..where xlCSV = 6.
> ..dave
>
> --
> Posted viahttp://www.ruby-forum.com/.- Hide quoted text -
>
> - Show quoted text -

note: if the workbook already defined then workbook.SavesAs("c:/augcsv/
myfile1.csv", xlCSV) works
This topic is locked and can not be replied to.