Page 1 of 1

Supress LastError message

PostPosted: Thu Feb 07, 2002 5:22 pm
by Jim Brammer
How can you supress the LastError message with your own message? Would like to capture the LastError durning a file copy with a custom message.



Sorry! This message got buried...

You can go into Book > Book Properties (F6) > Misc

Turn OFF the first checkmark, Display Error Messages. It also says that when it is turned off that error messages will be placed in the [LastError] Global Var.

You could then look at the [LastError] var to determine if there has been an error and decide what to do about it. Something like this...

(Hand Typed - Not Debugged!)

FileCopy "[Source]" "[Destination]"
If "[LastError]" "=" "File not found"
      AlertBox "Error" "The source file was not found"
      If "[LastError]" "<>" ""
              AlertBox "Error" "There was an error during File Copy"
              AlertBox "Done!" "File Copy Complete"


Thanks for the info.