how to get path of directory of document

S

santosh

Hi
I am developing a COM Addin in vc++.
I have to open any word document and then create an xml document of same
name in same directory in which the word document exists.
Please suggest any method to get the path of directory .
thanks
santosh
 
B

- B@rney

Not sure of syntax in C++, but in C#

string path = Word.Application.ActiveDocument.Path;
string fileName = Word.Application.ActiveDocument.Name;
string pathAndFileName = Word.Application.ActiveDocument.FullName;

Usually you'd reference Word.Application through the applicationObject field
instanciated in the OnConnection event like this:
<snip comment="Wizard generated code">
public void OnConnection(object application,
Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array
custom)
{
applicationObject = application;
addInInstance = addInInst;

if(connectMode != Extensibility.ext_ConnectMode.ext_cm_Startup)
{
OnStartupComplete(ref custom);
}
}
</snip>

And then referencing the active document like this:
Word.Document activeDoc =
((Word.Application)applicationObject).ActiveDocument;

Again: this is C#...

HTH
 

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