File called by Application.Open function in SVB code is automatically deleted after execution of the SVB code and close Statistica

File called by Application.Open function in SVB code is automatically deleted after execution of the SVB code and close Statistica

book

Article ID: KB0074288

calendar_today

Updated On:

Products Versions
Spotfire Statistica 13.0 and higher

Description

File called by Application.Open function in SVB code is automatically deleted after execution of the SVB code and close Statistica.

PROBLEM RECAP:

1. For example, below SVB macro calls and executes an external workspace located at "c:/temp/exportCSV.sdm", using Application.Open function

2. After execution of above SVB script and close Statistica, the workspace file called by Application.Open function, i.e. "c:/temp/exportCSV.sdm", was automatically removed from the local directory c:/temp/ folder. 

Issue/Introduction

File called by Application.Open function in SVB code is automatically deleted after execution of the SVB code and close Statistica

Environment

Windows

Resolution

The reason that the workspace file being called gets deleted after running the SVB script, is because the second parameter to function Application.Open is a Boolean flag "TreatAsTempFile". Default value of this parameter is "TRUE" which delete the file being called in the first parameter after the document is executed and the application is closed. This parameter should be set to "False" if user wants to keep the workspace file after execution.