Log in

View Full Version : Passing variables between different projects in Word 2010



Shelley
09-09-2011, 10:12 AM
Word 2010 - I have a function stored in the global macros in the startup folder named WPGlobalMacros. There is a function that stores the branch name to the variable "GetBranch" (there is a lot more code to this that determines what branch the user is at, but for simplity I have just assigned "Atlanta" to the variable here). I now want to retrieve that variable information in a template project named Project1. Nothing I do seems to work.: pray2:

Example:

WPGlobal(WPGlobalMacros)
Public Function GetBranch()
GetBranch = "Atlanta"
End Function

TemplateProject(Project1)
Public GetBranch

Sub RetrieveBranch
MsgBox "GetBranch is: " & GetBranch
End Sub

When running the RetrieveBranch macro I receive the error message that the variable is not defined.

The following code worked fine in Word 2002 and retrieved the variable information, but the first line of code code causes Word 2010 to shut down.:dunno

Public GetBranch

Sub RetrieveBranch
GetBranch = Application.Run("GetBranch")
MsgBox "GetBranch is: " & GetBranch
End Sub