PxPlus User Forum

Twitter Twitter Twitter

Recent Posts

Pages: [1] 2 3 ... 10
1
Programming / Re: Create/Update Excel Workbook
« Last post by Tom Anderson on Today at 07:27:12 PM »
OK, getting closer.
Created the following program:

01000 LET X_OBJ=NEW("*obj/excel")
01020 LET PATH$="c:\qc_updates\test.xlsx"
01040 LET RETVAL=X_OBJ'CREATEWORKBOOK(PATH$,1)
01060 LET RETVAL=X_OBJ'SETRANGE("A1:E1")
01080 LET NEW_RANGE$="one"+SEP+"two"+SEP+"three"+SEP+"*four"+SEP+"five"+SEP
01100 LET RETVAL=X_OBJ'WRITE(NEW_RANGE$)
01120 LET RETVAL=X_OBJ'SAVEWORKBOOK()
01140 LET RETVAL=X_OBJ'CLOSEWORKBOOK()
01160 DROP OBJECT X_OBJ

It completes successfully but the data in the cells A1 - E1 is the number 32003 in each cell.

Suggestions?

Tom
2
Programming / Re: Create/Update Excel Workbook
« Last post by Tom Anderson on Today at 04:22:57 PM »
Susan,

Using version 16.

Tom
3
Programming / Re: Create/Update Excel Workbook
« Last post by Susan Cryderman on Today at 04:16:46 PM »
If you are using PxPlus 2017 or newer - you can use the PxPlus Excel Object.

 ! demo program for Pxlus Excel Object
 ! retval can be checked after each command to ensure there were no errors
 !
  x_obj=NEW("*obj/excel") ! instantiate the object
 !
  path$="c:\spreadsheets\workbook_name.xlsx"
  retval=x_obj'CreateWorkbook(path$,1) ! 2nd parameter overwrites workbook_name.xlsx if it exits
  retval=x_obj'SetWorksheet(1) ! set active worksheet to 1 (not really neede - should already be 1 after creating the workbook
 !
  retVal=x_obj'write("value for cell C2","C2") ! ! Write a value to cell C2 in active worksheet
 !
  retval=x_obj'SetRange("A3:E3") ! set range to 5 cells in row 3
  new_range$="one"+SEP+"two"+SEP+"three"+SEP+"*four"+SEP+"five"+SEP
  retVal=x_obj'write(new_range$) ! write data to current range
 !
  retVal=x_obj'SaveWorkbook()
  retVal=x_obj'CloseWorkbook()
  DROP OBJECT x_obj
  END
4
Programming / Re: Create/Update Excel Workbook
« Last post by Tom Anderson on Today at 04:12:02 PM »
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
5
Nomads / Different Font Sizes on Panel
« Last post by James Zukowski on Today at 02:58:49 PM »
I'm updating a panel that has single-line multi_lines and multiple-line multi_lines. The fonts are different sizes: the multiple-line entries' fonts are 1/6 larger than the single-line entries (see attached snip). All of the font info and attributes are the same.

As a test, I shrank a multiple-line entry to 1 line and the font became the smaller size.

Anyone have any ideas?

Thanks, all!
6
Programming / Re: Create/Update Excel Workbook
« Last post by Jeffrey Ferreira on Today at 02:42:57 PM »
Oops - I thought that was Tom posting that.
7
Programming / Re: Create/Update Excel Workbook
« Last post by James Crowther on Today at 02:35:37 PM »
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"
8
Programming / Re: Create/Update Excel Workbook
« Last post by Jeffrey Ferreira on Today at 02:30:11 PM »
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
9
Programming / Create/Update Excel Workbook
« Last post by Tom Anderson on Today at 02:12:47 PM »
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
10
Nomads / Auto Complete not working in multiple sessions?
« Last post by James Zukowski on June 05, 2023, 01:56:47 PM »
While testing an update to a panel, I opened the old version in one session and the new version in a second session on the same workstation. Whichever session I first access for the autocomplete seems to lock out the other session; it's still a multi-line, but doesn't create the auto-complete drop-down.
Is there something I'm missing/not setting up? Any suggestions welcome.
Pages: [1] 2 3 ... 10