|
-
May 26th, 2000, 01:30 AM
#1
Thread Starter
New Member
For whatever reason the program I am designing does not want to let me exit the sub, every time I try it gives me an error that says "Runtime Error 5: Invalid procedure or call argument". I have tried using an error trapping routine and it doesnt catch the error, I tried creating a line name and saying "if ... then goto skipsub" and I tried just saying "if ... then exit sub" but nothing works, by the way, here is the line of code that I can't exit the sub with, Does anyone have any idea what is causing this error??? I would really appriciate some suggestions, thanks!
If UCase(Trim(Mid(d$, 23, 25))) <> userlevel$ Then Close: Exit Sub
-
May 26th, 2000, 01:37 AM
#2
transcendental analytic
1. Do you have an file open?
2. IS d$ longer than 23?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 26th, 2000, 02:36 AM
#3
Thread Starter
New Member
Yes
A file is open, and d$ is not longer than 25, but I have similar if ... then statements in the program, and I have no problem with those, if you think it would help, I will e-mail you the whole sub, thanks for your help.
-
May 26th, 2000, 03:07 AM
#4
Try removing the colon and poutting them on seperate lines.
Also, instead of Close you could also try Close #1 (or whatever file you have open.
Can you post up your whole code?
-
May 26th, 2000, 03:21 AM
#5
Thread Starter
New Member
Nope
Unfortunately, neither of those work, in fact I have similar lines of code in other parts of the program that work perfectly, I am really stumped, how else can you exit a sub, that is always when the crash occurs, just as the program exits the sub?
-
May 26th, 2000, 03:26 AM
#6
transcendental analytic
You can't use Exit Sub in a function or Property, go check that also. If it's not that, either post the whole sub here or send it to me
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 26th, 2000, 04:01 AM
#7
transcendental analytic
The code did run, i've just tested it, i removed the on error, caused me much erros but that one exiting the sub worked. What version are you using?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 26th, 2000, 05:18 AM
#8
Hyperactive Member
I would say that you are trying to exit sub before file is closed. I mean that file is closed by OS asynchronicaly and then OS returns message about completing file operation, but there is no Sub running any more. And this is what triggered Error 5, I beleive.
You should try Empty loop with DoEvents for a second or so, or check if file is closed as a loop condition. only after this you can exit sub.
-
May 26th, 2000, 05:27 AM
#9
-
May 26th, 2000, 05:51 AM
#10
transcendental analytic
That's not the case LG, i've tested his code. I suppose i need the whole project and the files attached to it to know where the problem is
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|