Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call a String Value from another Module - PLEASE HELP!!

Status
Not open for further replies.

smartrider

Programmer
Apr 18, 2003
21
US
I need help with this - please!!!

I have two different templates (which has two diff modules).Temp2 calls a module sub from temp1(I used Application.Run MacroName).I have also declare a variable (PUblic uname as string in module1(Temp1).

How can I get the value of uname from Template1 to Template2 ?

Please help out

thanks.


 
They are both in the same project, correct?

If so, and the variable is module-level and declared Public, you shouldn't be having any trouble.

Show the code, if you think you did all of the above.
 
I don't know about using templates, but working with two .doc files open, I was able to do this in Word 2000:

Code module in A.doc:
[blue]
Code:
Sub StoreVar()
  On Error Resume Next
  ThisDocument.Variables.Add ("VarFromA")
  ThisDocument.Variables("VarFromA") = "Hello from A"
End Sub
[/color]

Code module in B.doc:
[blue]
Code:
Sub GetFromA()
 MsgBox Documents("A.Doc").Variables("VarFromA")
End Sub
[/color]

Run "StoreVar" first, then run "GetFromA"

There should be a way to find the .doc names for which doc is based on Template1 and which doc is based on Template2, then use the technique illustrated above.

If nothing else, you can assign unique .Varible names by template and see which .doc file has which .Varible("xx") defined. (Maybe put code in the Document_Open event handler.)


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top