Variable no longer retaining value when using Word 2003

I'm having a problem with a Macro that is a Word Template. Under Office 2000 this macro works when users started getting Word 2003 things started to break. Here is what is happening.

The main Word Template essentially contains a menu which branches off to several other templates depending on which menu option you choose. Here is some sample code.

Public Const c_TemplateDir = "P:\MSOffice\Templates\"

Public g_MacroName as String

Sub Amendment()

g_MacroName = "Amend"


Documents.Add Template:= _
c_TemplateDir + "Amendment.dot", NewTemplate:=False

End Sub

Sub TDAmendment()

g_MacroName = "TDAmend"


Documents.Add Template:= _
c_TemplateDir + "Amendment.dot", NewTemplate:=False

End Sub

Sub RGAmendment()

g_MacroName = "RGAmend"


Documents.Add Template:= _
c_TemplateDir + "Amendment.dot", NewTemplate:=False

End Sub

When the theAmendment.dot template is created it also runs some code some below:

If g_MacroName = "Amend" Then
c_ThisMacroTemplate = "Amendment.doc"
ElseIf g_MacroName = "TDAmend" Then
c_ThisMacroTemplate = "TDAmendment.doc"
ElseIf g_MacroName = "RGAmend" Then
c_ThisMacroTemplate = "RGAmendment.doc"
End If

The problem i'm having is that g_MacroName is always an Empty string when it gets to this code, thus code following this piece does not work correctly. g_MacroName is only an Empty string when using Word 2003 but in Word 2000 it works fine. Anybody can tell me why this is and if there is a work around? Any other Suggestions?

[1771 byte] By [WilliamKlein] at [2008-1-9]
# 1

Nobody have any suggestions/solutions?

WilliamKlein at 2007-10-2 > top of Msdn Tech,Microsoft ISV Community Center Forums,Visual Basic for Applications (VBA)...