Goto...Return question

  • Thread starter Thread starter mousetrap
  • Start date Start date
M

mousetrap

Hi,

Here's part of my code:

Function doProcess(input as string) as integer
'(...code here)
Goto CleanUp
'(...code here)
Exit Function
CleanUp:
'(...code here)
if flag = true then
Return 'here I need to resume the
'function after the "Goto CleanUp" line
end if
'(...code here)
End Function

Here's the problem:
The "Return" line doesn't work. What do I need to write instead?
I'm using Goto because that part of the code is used many many times in
that function and I cannot rewrite it as another function.

Thanks

MouseTrap
 
Vasant Nanavati said:
Instead of "Return", use "Resume Next".

--

I already tried that. I get an error: Resume without error.

MouseTrap
 
mudraker said:
Change Goto Cleanup to GoSub Cleanup

I thought that GoSub worked only in a Sub and not in a function.
However, I tried it and it worked. Thanks.
 
My mistake ... I thought Cleanup was your error handler, but obviously it is
not!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top