Main Board > Programming

Create/Update Excel Workbook

(1/6) > >>

Tom Anderson:
I am attempting to create and update an Excel workbook from within PxPlus. I have read through the documentation and cannot not get it to work. I keep getting error 20's so obviously I do not understand how to format the code correctly.

All I want to do is create a new workbook or overwrite an existing one if it exists. Then I need to add data to the first worksheet within the workbook.

Could someone assist with some simple code to accomplish this.

Much thanks!

Tom Anderson

Jeffrey Ferreira:
Hi Tom,
I'm not sure at what point you are getting the error, but are you at least able to do this:

def object excel_obj,"Excel.Application"
filename$="c:\temp\customers.xls" ! Replace filename$ with your file name
workbook=excel_obj'workbooks'open(filename$)

can you get that far without an error?

jeff

James Crowther:
0010 DEF OBJECT EXCEL,"[WDX]EXCEL.APPLICATION"
0020 EXCEL'VISIBLE=1
0030 JUNK=EXCEL'WORKBOOKS'ADD()
0040 SHEET=EXCEL'ACTIVEWORKBOOK'WORKSHEETS(1)
0050 EXCEL'ACTIVEWORKBOOK'SHEETS(1)'NAME$="My Worksheet"
0060 ROW=1,COLUMN=1; SHEET'CELLS(ROW,COLUMN)'VALUE$="MY DATA"

Jeffrey Ferreira:
Oops - I thought that was Tom posting that.

Tom Anderson:
Jeff,

Here is what I get:

-}def object excel_obj,"[WDX]Excel.application"
-}filename$="c:\qc_updates\test.xls"
-}workbook=excel_obj'workbooks'open(filename$)
Error #88: Invalid/unknown property name

Tom

Navigation

[0] Message Index

[#] Next page

Go to full version