Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #11   Report Post  
Old August 17th 19, 07:35 PM posted to microsoft.public.excel.programming
external usenet poster
 
First recorded activity by ExcelBanter: Apr 2015
Posts: 1,058
Default Why the heck doesn't this work?

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How the heck? Dave Excel Worksheet Functions 6 April 8th 08 03:34 AM
trace dependent tool doesn't work but trace precendent doesn't marnie Excel Discussion (Misc queries) 2 May 24th 07 12:26 PM
What the heck is wrong here? [email protected] Excel Programming 1 January 5th 07 06:20 PM
macro doesn't properly record AutoSum (and SendKeys doesn't work) crimsonkng Excel Programming 2 November 21st 06 02:11 PM
Shell Doesn't Work With UNC - Can't Get ShellExecute to Work Either [email protected] Excel Programming 1 September 1st 06 05:35 AM


All times are GMT +1. The time now is 02:10 AM.

Powered by vBulletin® Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright 2004-2019 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"

 

Copyright © 2017