+ Reply to Thread
Results 1 to 2 of 2

If statement - run time error 68 - Device unavailable

Hybrid View

  1. #1
    Registered User
    Join Date
    02-11-2008
    Posts
    68

    If statement - run time error 68 - Device unavailable

    Hi,

    I am looking for an IF statement, If I get error - run time error 68 - Device unavailable then

    do this

    else
    do that

    could anyone help with the syntax?
    thanking you in advance, tapapad

  2. #2
    Valued Forum Contributor
    Join Date
    08-26-2006
    Location
    -
    MS-Off Ver
    2010
    Posts
    388
    Your code goes between the On Error GoTo and Exit Sub statements.
    If no error occurs, code runs to Exit Sub.
    Sub YourSub()
        Dim ThisandThat
        
        On Error GoTo ErrorHandler
        
        'your code goes here, between the On Error GoTo and Exit Sub statements
        'if no error occurs, code runs to Exit Sub
        
        Exit Sub
        
    ErrorHandler:
        If Err.Number = 68 Then
            MsgBox "Error number: " & Err.Number & vbCrLf & Err.Description, vbCritical, "Something is wrong!"
        Else
            MsgBox "A different error occurred"
        End If
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1