Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
There is a syntax error, it stops on the On error go to errorhandler line.
At one point there was a mention about needing a select in the case but now it doesn't do that. THANKS! Sub optCkforDupes_Click() Dim nResult As Long Debug.Print frRptDate Debug.Print toRptDate On Error GoTo ErrHandler Fprocess1 = False On Error GoToErrHandler If optCkforDupes.Value = True Then nResult = MsgBox(prompt:="From: " & FrReptDate & vbNewLine & "To: " & ToReptDate, Buttons:=bvOKCancel, Title:="report Date") End If If nResult = vbOK Then Call createXLdb.CkforDupes Fprocess1 = True End If Exit Sub ErrHandler: Case 9 Resume Case Else MsgBox Err.Number & " " & Err.Description End Select End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You were missing a couple of things.
you had no space between goto and ErrHandler. You select case needs the opening of the select case. Select case err.number I've added it to the code below. Cal Sub optCkforDupes_Click() Dim nResult As Long Debug.Print frRptDate Debug.Print toRptDate On Error GoTo ErrHandler Fprocess1 = False On Error GoTo ErrHandler If optCkforDupes.Value = True Then nResult = MsgBox(prompt:="From: " & FrReptDate & vbNewLine & "To: " & ToReptDate, Buttons:=bvOKCancel, Title:="report Date") End If If nResult = vbOK Then Call createXLdb.CkforDupes Fprocess1 = True End If Exit Sub ErrHandler: Select Case err.number Case 9 Resume Case Else MsgBox Err.Number & " " & Err.Description End Select End Sub "Janis" wrote: There is a syntax error, it stops on the On error go to errorhandler line. At one point there was a mention about needing a select in the case but now it doesn't do that. THANKS! Sub optCkforDupes_Click() Dim nResult As Long Debug.Print frRptDate Debug.Print toRptDate On Error GoTo ErrHandler Fprocess1 = False On Error GoToErrHandler If optCkforDupes.Value = True Then nResult = MsgBox(prompt:="From: " & FrReptDate & vbNewLine & "To: " & ToReptDate, Buttons:=bvOKCancel, Title:="report Date") End If If nResult = vbOK Then Call createXLdb.CkforDupes Fprocess1 = True End If Exit Sub ErrHandler: Case 9 Resume Case Else MsgBox Err.Number & " " & Err.Description End Select End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Syntax error in nested IF statement. | Excel Discussion (Misc queries) | |||
VBA Loop Case..If syntax | Excel Programming | |||
Syntax for Select Case | Excel Programming | |||
Select Case syntax | Excel Programming | |||
Case Statement error | Excel Programming |