473,385 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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_STATEMENT = 0 'Resume
Public Const RESUME_NEXT = 1 'Resume Next
Public Const UNRECOGNIZED = 3 'Unrecognized error
Public Const ERR_PERMISSIONDENIED = 70


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

MsgType = vbExalamation
Select Case errVal
Case ERR_PERMISSIONDENIED '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_STATEMENT
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(errVal As Integer) As Integer


Any help is appreciated .. cheers, Natasha
May 16 '07 #1
2 1081
SammyB
807 Expert 512MB
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(errVal 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
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Public Const RESUME_STATEMENT = 0 'Resume
  3. Public Const RESUME_NEXT = 1 'Resume Next
  4. Public Const UNRECOGNIZED = 3 'Unrecognized error
  5. Public Const ERR_PERMISSIONDENIED = 70
  6. Function FileErrors(ByVal errVal As Integer) As Integer
  7. Dim MsgType As Integer, Msg As String, Response As Integer
  8. MsgType = vbExclamation
  9. Select Case errVal
  10. Case ERR_PERMISSIONDENIED 'Error #70
  11. Msg = "That device is unavailable."
  12. MsgType = MsgType + vbAbortRetryIgnore
  13. Case Else
  14. FileErrors = UNRECOGNIZED
  15. Exit Function
  16. End Select
  17. Response = MsgBox(Msg, MsgType, "Disk Error")
  18. Select Case Response
  19. Case vbOK
  20. FileErrors = RESUME_STATEMENT
  21. Case vbIgnore
  22. FileErrors = RESUME_NEXT
  23. Case Else
  24. FileErrors = UNRECOGNIZED
  25. End Select
  26. End Function
  27.  
What VB are you using?
May 17 '07 #2
Killer42
8,435 Expert 8TB
The only thing I can think of initially is that it's expecting you to specify Private or Public before Function.
May 17 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Lodewijk van Haringhal | last post by:
I'am new with javascritping not with programming. Is there nobody who can help me with ths simple promblem? :) Please, please give me a hint. Please help me with this script. I have two lists in...
0
by: Kurt Watson | last post by:
I’m having a different kind of problem with Hotmail when I sign in it says, "Web Browser Software Limitations Your Current Software Will Limit Your Ability to Use Hotmail You are using a web...
4
by: pshindle | last post by:
DB2 Team - I just downloaded and unzipped the new Fixpack 9 for DB2 ESE V8 for Windows (FP9_WR21350_ESE.exe). I then burned the unzipped Fixpack files to a CD. I proceded to install this...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
5
by: Franco, Gustavo | last post by:
Hi, I have a question, and please I need a answer. How can I finalize a thread running with Application.Run (I need the message loop!!!) without call Thread.Abort?. I want to call...
3
by: Mark Broadbent | last post by:
could somebody please recommend a good book to prepare for exam Exam 70-320*: Developing XML Web Services and Server Components with Microsoft Visual C# and the Microsoft .NET Framework . One that...
22
by: settyv | last post by:
Hi, I need to write a Javascript which calculates datedifference as well as date comparision.When i try to embed the below script,it is working well,but the page is submitting even when the...
5
by: settyv | last post by:
Hi, Below is the Javascript function that am trying to call from asp:Button control. <script language="javascript"> function ValidateDate(fromDate,toDate) { var fromDate=new Date();
4
by: fatboySudsy | last post by:
Hi, I have constructed a client program that has given me some error codes that i just cannot see. I was wondering if a different set of eyes with much more experience than me could help me out. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.