I need to use WIN32OLE to do some Excel automation. I read some
documents and search google.The examples of how to use WIN32OLE are
almost the same. But none of them show how to translate a VBA code into
Ruby. Here are the VBA codes:
Sub AddNew()
Set NewBook = Workbooks.Add
With NewBook
.Title = "All Sales"
.Subject = "Sales"
.SaveAs Filename:="Allsales.xls"
End With
End Sub
I need to use WIN32OLE to do some Excel automation. I read some
documents and search google.The examples of how to use WIN32OLE are
almost the same. But none of them show how to translate a VBA code into
Ruby. Here are the VBA codes:
Sub AddNew()
Set NewBook = Workbooks.Add
With NewBook
.Title = "All Sales"
.Subject = "Sales"
.SaveAs Filename:="Allsales.xls"
End With
End Sub
I expect you can also do:
newbook=excel.Workbooks.Add
newbook.instance_eval do
Title = "All Sales"
Subject = "Sales"
SaveAs = Filename:="Allsales.xls"
end
But I'm guessing. I'd be interested to know if it works, but it would
be a closer mapping to VB's "with" expression.
···
On 11/20/06, Li Chen <chen_li3@yahoo.com> wrote:
Hi all,
I need to use WIN32OLE to do some Excel automation. I read some
documents and search google.The examples of how to use WIN32OLE are
almost the same. But none of them show how to translate a VBA code
into
Ruby. Here are the VBA codes:
Sub AddNew()
Set NewBook = Workbooks.Add
With NewBook
.Title = "All Sales"
.Subject = "Sales"
.SaveAs Filename:="Allsales.xls"
End With
End Sub