Home |
Search |
Today's Posts |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Tuesday, August 13, 2019 at 11:02:48 AM UTC-7, GS wrote:
You could dump the file into a string variable before splitting the lines into Yes, I agree I can do some basic checks to see if the file is not empty or if the file does not exist. However, if anything else crashes in my function, couldn't I just use the ON ERROR GOTO statement? Most all procedures *should have* an error handler built into them as a matter of 'best practice'. Example: Sub DoThis() 'Brief description of process intent 'Declare variables/constants 'Start code 'When it reaches a potential sect to raise an error... On Error GoTo ErrExit '//label specifying jump-to position 'Potential code to raise error ErrExit: 'Code to handle the error (and optionally Resume execution 'Code to cleanup objects before Exiting procedure 'Code to notify user of the error and/or request an action to take 'Function value to return ' ie: FunctionName = (Err = 0) if Boolean ' otherwise a null or default value End Sub Error handling is an elaborate convention on its own which entire book chapters are dedicated for. You can dismiss the error, display a message to the user, and/or write the error to an error.log file using a central error handling system in your VBA projects. -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How the heck? | Excel Worksheet Functions | |||
trace dependent tool doesn't work but trace precendent doesn't | Excel Discussion (Misc queries) | |||
What the heck is wrong here? | Excel Programming | |||
macro doesn't properly record AutoSum (and SendKeys doesn't work) | Excel Programming | |||
Shell Doesn't Work With UNC - Can't Get ShellExecute to Work Either | Excel Programming |