Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Pamela Baker   on Mar 02 In MS Office Category.

  
Question Answered By: Angel Watkins   on Mar 02

These variables  are being declared here, and have scope only within the
Sub.

They are built to pass arguments into the sub alone and if you want to
keep them globally, it's best to just pass global values to them. Let me
give you a little analogy in code:

----start of module
Global str_gl_Colour as String
Global str_gl_Animal as String
Global str_gl_Sentence as String
----
Sub CallString
str_gl_Colour = "Yellow"
str_gl_Animal = "Dog"
MakeString(str_gl_Colour, str_gl_Animal)
End Sub
----
Public Sub MakeString(myColour, myAnimal)
str_gl_Sentence = "I would love to own a " & myColour & " " & myAnimal
End Sub
----end of module

Share: 

 

This Question has 10 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Fundamental Q: passing/returning variables Or get search suggestion and latest updates.