![]() |
#4
|
|||
|
|||
![]()
Brian,
I do that a lot and I've posted a lot of code here with the lbl_Exit statement. I use phrase express and when I type sam in a VB code pane, I get: Sub ScratchMacro() 'A basic Word macro coded by Greg Maxey lbl_Exit: Exit Sub End SUb When I am reviewing other people's (often to fix), I usually add the lbl_Exit statement as a flag to remind me that I've already looked at that procedure. Often, and in those cases, it has no functional value and only there as style. Some folks from the old school used to practice never let a procedure run to the End Sub line. Exit first. Why, I don't know but it just became as habit for me. To make is useful, I would do something like this: Sub ScratchMacro() 'A basic Word macro coded by Greg Maxey Dim oRng as Range Set oRng = ActiveDocument.range On Error GoTo Err_Handler Err.Raise 6 lbl_Exit: Set oRng = Nothing Exit Sub Err_Handler: Msgbox Err.Number & " " & Err.Description Resume lbl_Exit End Sub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Chayes | Excel Programming | 8 | 06-05-2018 07:19 AM |
![]() |
Flobiwan | Office | 2 | 04-23-2017 04:27 AM |
Button does not generate proper colors? | cloudforgiven | Excel | 10 | 12-22-2016 09:57 PM |
proper | snoforlife | Excel Programming | 0 | 01-26-2016 02:16 PM |
Proper Text Format | sufian,naeem | Excel | 1 | 05-05-2014 05:59 AM |