what the diffrence between when you write a sub and you write
a function? and what's the difference between if you use "Declare"
to write a function?
[Etc. Private Sub 1234()
and
Private Function 1234()]
Printable View
what the diffrence between when you write a sub and you write
a function? and what's the difference between if you use "Declare"
to write a function?
[Etc. Private Sub 1234()
and
Private Function 1234()]
Take a look at this thread.
Also, more info here. http://msdn.microsoft.com/library/de...procedures.htm
A Sub (Sub-Rountine) contains a set of procedures that perform an action without returning a Value.
A Function is as above, but returns a value
e.g.
[Code]Public Function MySum(iAddMe as Integer) as Integer
MySum = iAddMe + 100
Exit Function
This can be called from another function or sub like so:
iTotal = MySum(iTotal) (which adds 100 to iTotal)
Declare Function is used when using function from external libraries like dlls. See www.vbapi.com for deatils...
that was the dumbest i ever posted... :eek:
i have used Sub and Functions before, i just never
knew ho to define it...
Captain's log: Additional.Quote:
what the diffrence between when you write a sub and you write
a function? and what's the difference between if you use "Declare"
to write a function?
[Etc. Private Sub 1234()
and
Private Function 1234()]
Mr. Spock has notified me that neither Subs nor Functions can be named with a number as the first letter!