Public/Private

  • Thread starter Thread starter James Golding
  • Start date Start date
J

James Golding

I have several sub procedures which run in sequence. In
one procedure I set a variable to a file name.
How can I select this in another sub procedure with
setting it again.
Hope this makes sense?
 
or

Sub Main
Dim var1

Sub1 var1
Sub2 var1
'etc.
End Sub

Sub Sub1(var)
msgbox var
End Sub


but I would advise to type the variables.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Brad Vontur said:
Dimension it in the Declarations section of your module; which is way up
at the top. This is a global variable.
Dim FileName as string
Private Sub Procedure1()
.... and so on.

Then set the value of the FileName in any procedure. Do not declare the
same variable name in any procedures, either.
 

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

Back
Top