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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word - finding the address of a word document from another

Status
Not open for further replies.

JohnnyRazzle

Programmer
May 4, 2005
10
GB
Hi all,
This is my dilemma. I have a template form that gets saved at a user defined location as a document. This document can then open another template and thus another document with its location also defined by the user. I need to access info from the first document from the second document. But i am a bit stuck as to how to find the address of the first location. This program is gonna run on a network and therefore people may have different names for the drives. Therefore im not sure if i shud use a temporary file. Should i use the registry, or is that bad practice in this case?
 
Hi JohnnyRazzle,

I don't completely understand what you're doing. Code in any document can access information about any other open document via the Documents collection. If the first document is still open you can find out what you like providing you know enough to identify it correctly. If it isn't still open then your options are a bit more limited - and I don't think there's anything in the registry which will help you.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Thats my problem though, i dont know enough to identify it(i dont think), cos the user could save it anywhere. I was thinking that i could save the address of the document in string format into the registry. Then i could read the key in from the other documents code to obtain the address so i could access the document and its formfields.
 
Hi JohnnyRazzle,

I wouldn't recommend using the registry for transient information.

Can you give a few more details of what you're doing - is this all done in code - what documents are open, etc? What, if anything, can you guarantee to be the case?

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Hio JohnnyRazzle.

We need more details.

I am unclear what is going on.

If the documents are open, and have been previously saved, then their path and filename is available. As Tony stated, use the Documents collection.

If the document are NOT open, but are saved files on a drive somewhere, you can still get path information using the FileSysteObject.

If the document are open, but not saved, then there is no path, although technically speaking , there is a sort of path.

What are you trying to do?

I also am confused by your use of the word "template". Are you using template in the real meaning? A cloned document created from a template using File > New? Anything other than that is not a proper template.

Do not use the registry. There is not need. If the other document is open, you can access anything in it directly.

If you would just describe, EXACTLY, what it is you are doing, I am sure we can suggest something.

Gerry
See my Paintings and Sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top