PxPlus User Forum

Twitter Twitter Twitter

Author Topic: *obj/Excel - When Dropped Excel Closes  (Read 1215 times)

Josh Fake

  • Member
  • **
  • Posts: 13
    • View Profile
    • Earnest & Associates
*obj/Excel - When Dropped Excel Closes
« on: June 12, 2019, 12:31:18 PM »
Using the new excel object *obj/excel, instantiating the object and making the changes to either a new worksheet or an existing worksheet, making it visible to the end user works great.
The only issue I have is that when I want to drop the object, it will close the excel spreadsheet.  I have viewed the pxplus documentation on the excel object, and could not find an answer, but is there a way to allow the excel worksheet to stay open and visible to the end user when the application drops the excel object? 

I want the end user to have the capability within excel itself to specify the location (due to using OneDrive/Sharepoint locations) where they want it saved instead of adding a new multi_line prompt within my code to do so.

Thanks for the help ahead of time!

Susan Cryderman

  • Staff
  • Gold Member
  • *****
  • Posts: 63
    • View Profile
    • PVX Plus Technologies Ltd.
Re: *obj/Excel - When Dropped Excel Closes
« Reply #1 on: June 12, 2019, 02:11:58 PM »
Josh,

Thanks for your explanation.  We will look into adding some sort of property to the next release which can be set if you wish excel (or word) to remain open when the object is dropped.

In the meantime - you could try creating your own excel object which inherits our object.   This object will contain only the definition of the EXCEL property.  Our object is coded with a SET ERR on the EXCEL property - but if your object is not, setting the EXCEL property to 0 might accomplish what you wish.

create an object (for the purposes of this example I have named it excel2.pvc):

 ! *obj/excel2 - MS Excel object which keeps Excel open
 !
  DEF CLASS "*obj/excel2"
 !
  LIKE "*obj/excel"
 !
 ! Properties
  PROPERTY EXCEL OBJECT ! Handle to main Excel object
 !
  END DEF


and then, in your code:

x=new("*obj/excel2")
x'openworkbook("someworkbook")
x'visible=1
excel=0
drop object x


Hope this helps!