Is there an example somewhere of how to use Object Rexx to read an Excel
file?
|
|
0
|
|
|
|
Reply
|
jerry
|
11/4/2004 12:19:30 AM |
|
Jerry,
I've got a couple of examples at http://pragmaticlee.safedataisp.net
If that is not enough, give me some examples of what you want to do
and I'll try to provide the code.
Lee Peedin
VP RexxLA
On Thu, 04 Nov 2004 00:19:30 GMT, "jerry chapman"
<jerryc314@sbcglobal.net> wrote:
>Is there an example somewhere of how to use Object Rexx to read an Excel
>file?
>
|
|
0
|
|
|
|
Reply
|
Lee
|
11/4/2004 3:46:33 AM
|
|
Jerry,
My email was out of date on my last post - this post should have the
correct email address if you desire to contact me directly.
BTW:
On the referenced web-page look for the file Excel_demo.zip
This zip file includes a PowerPoint Presentation that will detail how
to automate Microsoft Excel via Object Rexx 2.1.1. Please review this
presentation BEFORE running the demonstration application. The demo
application may need to be modified in regards to file paths - adjust
as necessary to your own system.
Lee
On Thu, 04 Nov 2004 03:46:33 GMT, Lee Peedin
<leepeedin_AT@_mindspring.DOTcom@> wrote:
>Jerry,
>I've got a couple of examples at http://pragmaticlee.safedataisp.net
>
>If that is not enough, give me some examples of what you want to do
>and I'll try to provide the code.
>
>Lee Peedin
>VP RexxLA
>
>On Thu, 04 Nov 2004 00:19:30 GMT, "jerry chapman"
><jerryc314@sbcglobal.net> wrote:
>
>>Is there an example somewhere of how to use Object Rexx to read an Excel
>>file?
>>
|
|
0
|
|
|
|
Reply
|
Lee
|
11/4/2004 3:57:17 AM
|
|
I built a small example based on Excel_demo.zip.
My_Excel=.OleObject~New('Excel.Application')
OpenIt=My_Excel~Workbooks~Open('C:\My_File.xls')
Row=1
Col='A'
Cell_Value=My_Excel~Cells(Row,Col)~Value
say 'value' Cell_Value
exit
When I ran it I got an error on then following line:
Cell_Value=My_Excel~Cells(Row,Col)~Value
An unknown OLE error occured (HRESULT=C0000005)
Am I missing something?
|
|
0
|
|
|
|
Reply
|
jerry
|
11/4/2004 2:03:28 PM
|
|
"jerry chapman" <jerryc314@sbcglobal.net> schrieb> Am I missing something?
>
Have you tried my mm.rex ?
works like a charm on my Windows XP
Walter
|
|
0
|
|
|
|
Reply
|
Walter
|
11/4/2004 2:48:21 PM
|
|
Jerry,
Try this code (watch for line wraps!!)
This expects there to be a my_file.xls in the root drive c:\
/* test_excel.rex */
My_Excel=.OleObject~New('Excel.Application')
-- if you want to watch what is happening remove the comment indicator
(of course it will be fast)
-- my_excel~visible = .true
OpenIt=My_Excel~Workbooks~Open('C:\My_File.xls')
/*
Jerry, at this point you are confusing "setting a value" & "retrieving
a value"
Row=1
Col='A'
Cell_Value=My_Excel~Cells(Row,Col)~Value
say 'value' Cell_Value
Try this
*/
-- this will retrieve the value of the cell
row = 1
col = 'A'
existing_value = My_Excel~Cells(row,col)~value
say 'The value of cell' row||col '=' existing_value
-- this will set the value of the cell
row = 1
col = 'A'
newvalue = existing_value * 2
say 'The value of cell' row||col 'will be changed to =' newvalue
My_Excel~Cells(row,col)~value = newvalue
say 'The new value of cell' row||col '=' My_Excel~Cells(row,col)~value
-- Make this true if you want to confirm overwriting the existing file
my_excel~displayalerts = .false
-- Save the workbook with the new value
my_excel~activeworkbook~save
--Close the workbook IF you want to use your object (my_excel) to open
another one
my_excel~activeworkbook~close
-- Be sure you quit the application - if you don't you leave Excel
running
-- Check you processes now and kill any Excel you may have left open
(or reboot)
my_excel~quit
exit
On Thu, 04 Nov 2004 14:03:28 GMT, "jerry chapman"
<jerryc314@sbcglobal.net> wrote:
>I built a small example based on Excel_demo.zip.
>
>My_Excel=.OleObject~New('Excel.Application')
>OpenIt=My_Excel~Workbooks~Open('C:\My_File.xls')
>Row=1
>Col='A'
>Cell_Value=My_Excel~Cells(Row,Col)~Value
>say 'value' Cell_Value
>exit
>
>When I ran it I got an error on then following line:
>
>Cell_Value=My_Excel~Cells(Row,Col)~Value
>
>An unknown OLE error occured (HRESULT=C0000005)
>
>Am I missing something?
>
|
|
0
|
|
|
|
Reply
|
Lee
|
11/4/2004 4:09:26 PM
|
|
By modifing the example supplied by Walter u. Christel Pachl I was able to
everything I need to do.
My new task is to create an Excel file.
Where can I find examples of tasks such as: setting column width, setting
row height and setting border type and width?
"Lee Peedin" <lpeedinREMOVE@UPPERCASEnc.rr.com> wrote in message
news:gukko0le843eik5ugph1cs30564dn4k2p2@4ax.com...
> Jerry,
> Try this code (watch for line wraps!!)
>
> This expects there to be a my_file.xls in the root drive c:\
>
> /* test_excel.rex */
>
> My_Excel=.OleObject~New('Excel.Application')
>
> -- if you want to watch what is happening remove the comment indicator
> (of course it will be fast)
> -- my_excel~visible = .true
>
> OpenIt=My_Excel~Workbooks~Open('C:\My_File.xls')
>
> /*
> Jerry, at this point you are confusing "setting a value" & "retrieving
> a value"
>
> Row=1
> Col='A'
> Cell_Value=My_Excel~Cells(Row,Col)~Value
> say 'value' Cell_Value
>
> Try this
> */
>
> -- this will retrieve the value of the cell
> row = 1
> col = 'A'
> existing_value = My_Excel~Cells(row,col)~value
> say 'The value of cell' row||col '=' existing_value
>
> -- this will set the value of the cell
> row = 1
> col = 'A'
> newvalue = existing_value * 2
> say 'The value of cell' row||col 'will be changed to =' newvalue
> My_Excel~Cells(row,col)~value = newvalue
>
> say 'The new value of cell' row||col '=' My_Excel~Cells(row,col)~value
>
> -- Make this true if you want to confirm overwriting the existing file
> my_excel~displayalerts = .false
>
>
> -- Save the workbook with the new value
> my_excel~activeworkbook~save
>
> --Close the workbook IF you want to use your object (my_excel) to open
> another one
> my_excel~activeworkbook~close
>
> -- Be sure you quit the application - if you don't you leave Excel
> running
> -- Check you processes now and kill any Excel you may have left open
> (or reboot)
> my_excel~quit
> exit
>
>
>
> On Thu, 04 Nov 2004 14:03:28 GMT, "jerry chapman"
> <jerryc314@sbcglobal.net> wrote:
>
> >I built a small example based on Excel_demo.zip.
> >
> >My_Excel=.OleObject~New('Excel.Application')
> >OpenIt=My_Excel~Workbooks~Open('C:\My_File.xls')
> >Row=1
> >Col='A'
> >Cell_Value=My_Excel~Cells(Row,Col)~Value
> >say 'value' Cell_Value
> >exit
> >
> >When I ran it I got an error on then following line:
> >
> >Cell_Value=My_Excel~Cells(Row,Col)~Value
> >
> >An unknown OLE error occured (HRESULT=C0000005)
> >
> >Am I missing something?
> >
>
|
|
0
|
|
|
|
Reply
|
jerry
|
11/5/2004 2:20:41 AM
|
|
|
6 Replies
321 Views
(page loaded in 0.004 seconds)
Similiar Articles: Read Excel with Object Rexx - comp.lang.rexxIs there an example somewhere of how to use Object Rexx to read an Excel file? ... ORexx and automating pdf output for 300+ excel workbooks - comp ...Read Excel with Object Rexx - comp.lang.rexx | Computer Group ORexx and automating pdf output for 300+ excel workbooks - comp ..... given a task that seems to be the ... Search in *.rex files - comp.lang.rexxRead Excel with Object Rexx - comp.lang.rexx This expects there to be a my_file.xls in the root drive c:\ /* test_excel.rex */ My_Excel ... My new task is to create an ... 10 New ooRexx sample scripts available for download - comp.lang ...Read Excel with Object Rexx - comp.lang.rexx 10 New ooRexx sample scripts available for download - comp.lang ..... methods, attributes, and constants in an ActiveX/OLE ... writing a function to load mat files and then writing a callback ...Read Excel with Object Rexx - comp.lang.rexx writing a function to load mat files and then writing a callback ..... load('whatever', 'var1', 'var2'); > "Unable to read ... JAVASCRIPT AND EXCEL, SET OUTPUT FILE NAME - comp.lang.javascript ...... to set the output file name of a excel ... name propertie but it seems to be > read ... for file name etc. ... comp.lang.rexx ORexx and automating pdf output for 300+ excel ... Incorporating data from a variable in xlswrite filename - comp ...Hi, I'm putting together a little file to read data ... xlswrite save as pop up with Excel 2007 - comp.soft-sys ... Modifying Select Elements in Array of Objects - comp.lang ... Where did Fortran go? - comp.lang.fortranI have no idea why, but that's what I read from the ... understand why, for example, it is so difficult for excel ... For a Fortran user, Rexx would be more appropriate as ... Problem using COM automation server out of .net-Application - comp ...Hi dear: I read your problem in the internet: 1. http ... OLE Automation - Outlook issue - comp.lang.rexx Problem ... Excel 2007 and "setPrintArea" - comp.lang.cobol Problem ... Macro Problem? - comp.soft-sys.sasThe (b) type tables relating an aspect to an object is ... force option may help a bit. base dataset will not read ... been given a task that seems to be the ultimate Rexx ... Read Excel with Object Rexx - comp.lang.rexx | Computer GroupIs there an example somewhere of how to use Object Rexx to read an Excel file? ... Error reading Excel sheet with #! type error - REXX13 *-* Say '('iCol','iRow'):' myWorkSheet~Cells(iRow,iCol)~Value Error 92 running H:\My Documents\Source\ooRexx\tExcel.rex line 13: OLE error Error 92. 7/30/2012 3:06:37 PM
|