Hi Mirka,
Declare the global variable in only one place. Declare it before the first
routine in a module, and use the Public keyword. Make sure that there are no
duplicate declarations anywhere.

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
>I have the following problem, I have two modules, that means two macros, in
> my application and there are some subroutines which are common and I was
[quoted text clipped - 9 lines]
> should be another way except of copying the subroutines in both modules,
> right?
Mirka - 28 Jul 2005 14:25 GMT
Thank you Jonathan for your reply.
I followed your steps -I haven't thought about the public declaration of the
variable- but once again the value of my global variable does not change when
I call the sub from the other module.
> Hi Mirka,
>
[quoted text clipped - 15 lines]
> > should be another way except of copying the subroutines in both modules,
> > right?
Jonathan West - 28 Jul 2005 14:33 GMT
Can you show me the code you are using, both to declare the variable and to
change it? Indicate the exact name and type of module where both the
variable declaration and calling code are located.

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
> Thank you Jonathan for your reply.
>
[quoted text clipped - 31 lines]
>> > modules,
>> > right?
Mirka - 29 Jul 2005 07:40 GMT
I have two modules in the folder 'modules' of my project, module1 and module2.
I declare my variables 'version', 'inMaster' and 'inDetails' at the
beginning of module1 before my first function by this way: public version as
integer, public inMaster as boolean and public inDetails as boolean. Then in
module1 again I have the following sub:
Public Sub Determine_Location_Version(ByVal xNode As MSXML2.IXMLDOMNode)
' We get out from "Master" but not out of "Body"
If inMaster = True And xNode.ParentNode.nodeName = "Body" Then
inMaster = False
End If
' We get in "Master"
If xNode.nodeName = "Master" Then
inMaster = True
' Check which xml version we have
If xNode.HasChildNodes Then
For i = 0 To xNode.ChildNodes(0).ChildNodes.Length - 1
If xNode.ChildNodes(0).ChildNodes(i).nodeName = caption Then
version = 2
End If
Next
End If
End If
' We get out from "Details" but not out of "Body"
If inDetails = True And xNode.ParentNode.nodeName = "Body" Then
inDetails = False
End If
' We get in "Details"
If xNode.nodeName = "Details" Then
inDetails = True
End If
End Sub
In module2 I do not declare these 3 variables once again as you told me and
I call the sub somewhere in my code by: module1.Determine_Location_Version
xNode.
> Can you show me the code you are using, both to declare the variable and to
> change it? Indicate the exact name and type of module where both the
[quoted text clipped - 35 lines]
> >> > modules,
> >> > right?