Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
win32ole and excel and copy
Li Chen
11/8/2006 1:34:00 PM
Hi all,
I use wind32ole to import data and create graphs into Excel. I find the
graphs can't be copied or resized. Any comments?
Thanks,
Li
--
Posted via
http://www.ruby-...
.
2 Answers
greg.rb
11/8/2006 3:42:00 PM
0
Li Chen wrote:
> Hi all,
>
> I use wind32ole to import data and create graphs into Excel. I find the
> graphs can't be copied or resized. Any comments?
>
> Thanks,
>
> Li
# Here is sample code to copy a chart in a worksheet:
require 'win32ole'
xl=WIN32OLE::new('Excel.Application')
xl.Visible=1 #show excel
xl.Workbooks.Open('c:\\testme.xls') #will open a file
xl.sheets(1).activate #activate the sheet you want
xl.ActiveSheet.ChartObjects("Chart 1").Activate #activate the chart
xl.ActiveChart.ChartArea.Select
xl.ActiveChart.ChartArea.Copy
xl.Windows("testme.xls").Activate
xl.Cells(50,1).Select # select row and col to paste chart
xl.ActiveSheet.Paste
#xl.ActiveWorkbook.Close()
#xl.Quit
#greg
--
Posted via
http://www.ruby-...
.
Li Chen
11/8/2006 10:19:00 PM
0
Greg Halsey wrote:
>> # Here is sample code to copy a chart in a worksheet:
>
> require 'win32ole'
>
> xl=WIN32OLE::new('Excel.Application')
> xl.Visible=1 #show excel
>
> xl.Workbooks.Open('c:\\testme.xls') #will open a file
>
> xl.sheets(1).activate #activate the sheet you want
>
> xl.ActiveSheet.ChartObjects("Chart 1").Activate #activate the chart
>
> xl.ActiveChart.ChartArea.Select
> xl.ActiveChart.ChartArea.Copy
> xl.Windows("testme.xls").Activate
> xl.Cells(50,1).Select # select row and col to paste chart
> xl.ActiveSheet.Paste
>
>
> #xl.ActiveWorkbook.Close()
> #xl.Quit
>
> #greg
Hi Greg,
I try the script but I find it only open an designated file only. I
still can't copy the chart. BTW there is plug-in in Excel called Visual
Basic editor. Is it the same as Visual Basic environment?
Thanks,
Li
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
win32ole and excel and copy
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password