View Full Version : two functions into one?


1jet
09-25-2008, 02:00 PM
Hello again all,

First of all I think I should thank everyone on this forum for what I've learnt thus far.

This time I'm going to put together two functions.

=vbaPasswordCheck() and =vbaAppendData have been created as two separate event triggered functions.

I'd now like to know how I can refer to =vbaAppendData using such code from within =vbaPasswordCheck.
(I'm thinking I've seen the terminology sub function around and it's related).

If I did this, would =vbaAppendData finish then GO BACK into =vbaPasswordCheck from which it was launched?

Thanks!

pbaldy
09-25-2008, 02:11 PM
If I did this, would =vbaAppendData finish then GO BACK into =vbaPasswordCheck from which it was launched?

Yes; code would pass from the first function to the second, then return and run the next line in the first after finishing the second.

1jet
09-25-2008, 02:25 PM
Alright, so how do I code for this to happen?

pbaldy
09-25-2008, 02:31 PM
From within the first one simply call the second:

vbaAppendData

1jet
09-25-2008, 02:35 PM
Hahaha...
If you can at least give me a small clue such as the calling command I can search the forum for more useful information?

wazz
09-25-2008, 02:40 PM
that's it. just type the name of the function. and it's called. there can be some variation if you're passing parameters, otherwise, that's it.

(oh, hi paul i thought you were gone.)

pbaldy
09-25-2008, 02:46 PM
No problemo, wazz.

1jet, you can also call it with the Call statement in VBA, but it's not necessary. As wazz said, just type the name of the function. If you use Call, parentheses are required, otherwise not (more info in VBA help on Call).

1jet
09-25-2008, 02:47 PM
Gees, you guys weren't kidding.
Yeah I've just put in the name of the function and it worked!
Cheers fellas

wazz
09-25-2008, 03:04 PM
it's a function. like Date or Now. just type it in. very nice.

(ignore what i said about parameters, i meant there's some variation when using Call, as paul said).