VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What different Sub, Public, Private and Function

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
255 Views, 4 Replies

What different Sub, Public, Private and Function

I still confuse to adopted that code with added "sub" "public" "private" etc
, would you please to tell me what diffrent function.

sub test()
bla..
bla..
end sub
'--------------------
public test()
bla..
bla..
end public
'------------------
private test()
bla..
bla..
end private
'--------------
function test()
bla..
bla..
end function
'---------------
public sub test()
bla..
bla..
end public
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Anonymous

highlight 'private' in vbaide.

public lets your subroutine or function be available for use by other modules

private 'Indicates that the Sub procedure is accessible only to other procedures in the module where it is declared.'

etc
Message 3 of 5
Anonymous
in reply to: Anonymous

thanks for you answerd, i would check again in help file.

wrote in message news:5974101@discussion.autodesk.com...
highlight 'private' in vbaide.

public lets your subroutine or function be available for use by other
modules

private 'Indicates that the Sub procedure is accessible only to other
procedures in the module where it is declared.'

etc
Message 4 of 5
Anonymous
in reply to: Anonymous

Your question can be divided in following two parts
1. difference between sub and function
2. difference between private and public

Sub procedures doesn't return a value while by using functions you can get the returned value e.g.

Public function XX(byval YY) as string
End function

Private functions or sub can be used within a single module where they are defined while public procedures can be call from anywhere within the project.

Hope I make the thing clear to you.

Kaushal
Message 5 of 5
Anonymous
in reply to: Anonymous

it's good info, I got it.
thanks.

wrote in message news:5975553@discussion.autodesk.com...
Your question can be divided in following two parts
1. difference between sub and function
2. difference between private and public

Sub procedures doesn't return a value while by using functions you can get
the returned value e.g.

Public function XX(byval YY) as string
End function

Private functions or sub can be used within a single module where they are
defined while public procedures can be call from anywhere within the
project.

Hope I make the thing clear to you.

Kaushal

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost