Please Help .. thanks

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • natasharose
    New Member
    • Apr 2007
    • 8

    Please Help .. thanks

    Hi,

    I am new to scripting and was hoping that someone could provide me with some assistance with the error that I am receiving. Here is my code:

    Public Const RESUME_STATEMEN T = 0 'Resume
    Public Const RESUME_NEXT = 1 'Resume Next
    Public Const UNRECOGNIZED = 3 'Unrecognized error
    Public Const ERR_PERMISSIOND ENIED = 70


    Function FileErrors(errV al As Integer) As Integer
    Dim MsgType As Integer, Msg As String, Response As Integer

    MsgType = vbExalamation
    Select Case errVal
    Case ERR_PERMISSIOND ENIED 'Error #70
    Msg = "That device is unavailable."
    MsgType = MsgType + vbokIgnore
    Case Else
    FileErrors = UNRECOGNIZED
    Exit Function
    End Select
    Response = MsgBox(Msg, MsgType, "Disk Error")
    Select Case Response
    Case vbOK
    FileErrors = RESUME_STATEMEN T
    Case vbIgnore
    FileErrors = RESUME_NEXT
    Case Else
    FileErrors = UNRECOGNIZED
    End Select
    End Function


    I am trying to setup a function for error handling, specifically to test handling the error permission denied ... I get a compile error of:

    ' ) ' expected in the following line:

    Function FileErrors(errV al As Integer) As Integer


    Any help is appreciated .. cheers, Natasha
  • SammyB
    Recognized Expert Contributor
    • Mar 2007
    • 807

    #2
    Originally posted by natasharose
    Hi,

    I am new to scripting and was hoping that someone could provide me with some assistance with the error that I am receiving.
    <snip>
    I am trying to setup a function for error handling, specifically to test handling the error permission denied ... I get a compile error of:

    ' ) ' expected in the following line:

    Function FileErrors(errV al As Integer) As Integer


    Any help is appreciated .. cheers, Natasha
    It compiles OK in VB.Net and VBA for me, except for vbExalamation which should be vbExclamation and vbokIgnore which does not exist. I translated the typos into
    [code=vb]
    Option Explicit
    Public Const RESUME_STATEMEN T = 0 'Resume
    Public Const RESUME_NEXT = 1 'Resume Next
    Public Const UNRECOGNIZED = 3 'Unrecognized error
    Public Const ERR_PERMISSIOND ENIED = 70
    Function FileErrors(ByVa l errVal As Integer) As Integer
    Dim MsgType As Integer, Msg As String, Response As Integer
    MsgType = vbExclamation
    Select Case errVal
    Case ERR_PERMISSIOND ENIED 'Error #70
    Msg = "That device is unavailable."
    MsgType = MsgType + vbAbortRetryIgn ore
    Case Else
    FileErrors = UNRECOGNIZED
    Exit Function
    End Select
    Response = MsgBox(Msg, MsgType, "Disk Error")
    Select Case Response
    Case vbOK
    FileErrors = RESUME_STATEMEN T
    Case vbIgnore
    FileErrors = RESUME_NEXT
    Case Else
    FileErrors = UNRECOGNIZED
    End Select
    End Function
    [/code]
    What VB are you using?

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      The only thing I can think of initially is that it's expecting you to specify Private or Public before Function.

      Comment

      Working...