Public Sub vs. Private Sub

  • Thread starter Becky Carter Hickman-Jones
  • Start date
B

Becky Carter Hickman-Jones

I'm just learning VBA now, and I would like to know the difference between a
Public Sub and a Private Sub.

Would someone please explain this for me?

Thanks,
Beck
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < Becky Carter Hickman-Jones > écrivait :
In this message, < Becky Carter Hickman-Jones > wrote:

|| I'm just learning VBA now, and I would like to know the difference
between a
|| Public Sub and a Private Sub.
||

A Public Sub can be called by any other Sub from any project. Unless you use
"Option Private Module" in which case, the Public Sub is restricted to the
Project where it resides.

A Private Sub can only be called within the module where it resides.

From the Word VBE, Type "Public Sub Test" then hit Enter.
Then, select the word "Public" and hit F1 for more info on the topic. Once
there, you can also read about "Private" by cross-referencing from the "See
Also" key word on the help page. Note that the same concept apply when you
declare variables.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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

Top