Variable no longer retaining value when using Word 2003

B

Bill Klein

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 the Amendment.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?
 

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