PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: Prajin P K on July 23, 2018, 10:05:19 AM

Title: Create Chart on excel sheet
Post by: Prajin P K on July 23, 2018, 10:05:19 AM
Hi,
 How can i generate chart on excel sheet together with data table
Title: Re: Create Chart on excel sheet
Post by: Prajin P K on July 31, 2018, 07:09:45 AM
Hi team,
I have created chart on excel sheet by using code found from the documentation, but on execute code  data and chart is coming different excel file. My need is its should come in same file.

Please give the instructions to do that. and also give explanation about how to set properties for creating chart on excel. The example code i have used is given below:

Code: [Select]
  OPEN (1)"[DDE]excel;existing_worksheet.wk1"
  OPEN (2)"SALES"
   LET R=0
LOOP:
   LET DIV_ID$=KEY(2,END=DRAW_IT)
   READ (2,KEY=DIV_ID$)DIV_NAME$,DIV_SALES
   LET R=R+1 ! Bump row number
   LET K$="R"+STR(R)+"C1:R"+STR(R)+"C2"
   WRITE RECORD (1,KEY=K$)DIV_NAME$+$09$+STR(DIV_SALES)
   GOTO LOOP
DRAW_IT:
   IF R=0 THEN STOP ! No divisions
   LET X$="R"+STR(R)
   WRITE RECORD (1)"[select(""R1C1:"+X$+"C2"","""+X$+"C2"")]"
   WRITE RECORD (1)"[new(2,1)]"
   WRITE RECORD (1)"[gallery.3d.pie(6)]"
   WRITE RECORD (1)"[window.maximize()]"
   WRITE RECORD (1)"[app.maximize()]"
Thank you,
Title: Re: Create Chart on excel sheet
Post by: Mike King on July 31, 2018, 09:39:58 AM
Documentation on the Excel macros using DDE is no longer easily available from Microsoft.  You can find the original documentation on Excel DDE from Microsoft in a .HLP file call "MACROFUN.HLP" however, ever since Vista, Windows no longer supports this file format so the file is not of much use on newer systems.

Instead Microsoft recommends you use the COM/OLE interfaces for Excel.  You can find a lot of documentation on the methods and properties associated with this interface online.

PxPlus (like EXCEL) still supports both, DDE for older applications and COM/OLE for newer applications.