PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Example: Using (if possible) the existing Excel session for an OLE Automation dialog
GetActiveObject (Example)
Example: Using (if possible) the existing Excel session for an OLE Automation dialog
The following example is used to control Excel via OLE Automation. If an Excel session is already active, this session is used for the Automation dialog.
The automation object is freed at the end of the Excel session.
Excel is dynamic Automation object
// If Excel is already started, retrieve it
Excel = GetActiveObject("Excel.Application")
IF Excel = Null THEN
// Excel is not started: start
Excel = new object Automation "Excel.Application"
IF Excel = Null THEN
Error("Unable to start Excel")
RETURN
END
END
IF Excel <> Null THEN
// Control Excel
...
// Free the Excel object used
delete Excel
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment