ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / XLS file functions
  • Returning the last error that occurred on an XLS file
  • Returning the last error that occurred on an XLS file
xlsMsgError (Example)
Returning the last error that occurred on an XLS file
WINDEVUser code (UMC)
The following code returns an error message if xlsOpen and xlsData threw an error.
// Declare the variables
ResData is string
XLSFileID is int
// Open an XLS file
XLSFileID = xlsOpen("C:\MyDirectories\MyFiles\File.XLS")
IF XLSFileID <> -1 THEN
// Retrieve the content of a cell
ResData = xlsData(XLSFileID, 3, 4)
IF ResData = "" THEN
IF xlsMsgError(XLSFileID) = "" THEN
// The cell is empty
Info("The cell is empty")
ELSE
// Display an error message if the retrieval was not performed
Error(xlsMsgError(XLSFileID))
// Identical to: Error(ErrorInfo(errMessage))
END
ELSE
// Display the content of the cell
Info("The content of the cell is: " + ResData)
END
ELSE
// Display an error message if the opening was not performed
Error(xlsMsgError(XLSFileID))
// Identical to: Error(ErrorInfo(errMessage))
END
Returning the last error that occurred on an XLS file
The following code returns an error message if xlsOpen and xlsData threw an error.
// Declare the variables
ResData is string
XLSFileID is int
// Open an XLS file
XLSFileID = xlsOpen("C:\MyDirectories\MyFiles\File.XLS")
IF XLSFileID <> -1 THEN
// Retrieve the content of a cell
ResData = xlsData(XLSFileID, 3, 4)
IF ResData = "" THEN
IF xlsMsgError(XLSFileID) = "" THEN
// The cell is empty
Info("The cell is empty")
ELSE
// Display an error message if the retrieval was not performed
Error(xlsMsgError(XLSFileID))
// Identical to: Error(ErrorInfo(errMessage))
END
ELSE
// Display the content of the cell
Info("The content of the cell is: " + ResData)
END
ELSE
// Display an error message if the opening was not performed
Error(xlsMsgError(XLSFileID))
// Identical to: Error(ErrorInfo(errMessage))
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help