win32ole question....

D

Dave Rose

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?
 
J

Jan Svitok

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)
 
B

bbiker

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

note: if the workbook already defined then workbook.SavesAs("c:/augcsv/
myfile1.csv", xlCSV) works
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,230
Messages
2,571,161
Members
47,794
Latest member
LucretiaEl

Latest Threads

Top