Porovnávané verzie

Kľúč

  • Tento riadok sa pridal
  • Riadok je odstránený.
  • Formátovanie sa zmenilo.

...

Declarationstartexcel [/Q] [/I] [/D] [/R] fullXlsPath [StartMakro [ param1 .. paramN ]]
specifically for automatic export:
startexcel [/Q] [/I] [/D] [/R] fullXlsPath StartParams EXP
Parameters


/QEnables writing of possible errors into the log file (startexcel.log) and terminating the utility StartExcel if any errors occur.
/IRuns the MS Excel as visible. Optional parameter.
This parameter is not recommended to use on the operating systems MS Server 2008, MS Vista and Windows 7 if the parameter is started as service (e.g. SELF.EVH started as service).
/DEnables writing the debug information including the list of parameters, which were entered when its starting, into log file.
/R

Disables the utility from overwriting the registry value
Computer\HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\Options\DisableMergeInstance to 1.

By default, it sets this value to 1 to prevent new Excel instances from merging with existing ones.

fullXlsPathFull path to report (workbook).
StartMacroOptional name of the macro in the document, that is to be executed.
param1 .. paramNOptional parameters of the macro StartMacro.
StartParamsName of macro in the report, that will execute its data export.
EXPParameter of the macro StartParamsspecifying that export of data is to be performed.


DescriptionThe utility StartExcel runs the MS Excel. If the parameter /I is defined, the MS Excel will be opened as visible. If the parameter /Q is entered, any errors will be written into the file startexcel.log and the utility StartExcel will be terminated.
Then a workbook specified by the parameter fullXlsPath will be opened and it will call the macro StartParams with the parameter EXP. The macro must be implemented in the workbook (if the workbook has been created from the template D2000_WorkBook.xlt, the macro is already included in it).

The workbook is automatically logged on to the D2000 system according to logon parameters (USER_NAME, PASSWORD, SERVER), it evaluates itself and a saves a copy of the active sheet into a new file defined, whose name is defined in the cell EXPORT_FILE_NAME. By default, the cell is filled with an expression that adds the date and time to the workbook name. In the application, it is necessary to change the directory destined for exported reports. By default, it is set to C:\Reports.
Report evaluation is executed by setting the times of the cells D2000_BT a D2000_ET to the current time.

...

INT _ret
TEXT _txtMsg
TEXT _report = "c:\Reports\test1.xls"

; report export with 50 seconds timeout
_ret := RUN "startexcel.exe" SYNC " " + _report + " StartParams EXP" TIMEOUT 50
IF _ret\VLD THEN
IF _ret = _ERR_TIME_OUT THEN
  _txtMsg := "TIMEOUT for report export"
ELSE
_txtMsg := "Export ExitCode = " + %IToStr(_ret)
IF _ret = 0 THEN
  _txtMsg := _txtMsg + " OK"
ELSE
IF _ret = 1 THEN
  _txtMsg := _txtMsg + " Init Ole Error"
ELSE
IF _ret = 2 THEN
  _txtMsg := _txtMsg + " Start Excel Error"
ELSE
IF _ret = 3 THEN
  _txtMsg := _txtMsg + " Open Report Error"
ELSE
IF _ret = 4 THEN
  _txtMsg := _txtMsg + " Run Macro Error"

ELSE

IF _ret = 12 THEN
  _txtMsg := _txtMsg + " Set Registry Error"
ELSE
  _txtMsg := _txtMsg + " Unknown Error"
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ELSE
  _txtMsg := "Attempt to run startexcel.exe has failed"
ENDIF

LOG _txtMsg, SysTime
END

...