Discussion:
Word Addin How can I select the using file?
(too old to reply)
dev
2007-04-17 16:02:05 UTC
Permalink
Hi,
I'd like to create an Add-in that put the name of the document I using with
Word to another external process.
I did an Add-in that can start an external process, but I can't get the name
of the document I using.

Can you help me?

thanks
Perry
2007-04-17 18:36:16 UTC
Permalink
What do you mean "external process"?

Do you mean
- another Office application?
- another application? If so, what?


--
Krgrds,
Perry

System:
Vista/Office Ultimate
VS2005/VSTO2005 SE
Post by dev
Hi,
I'd like to create an Add-in that put the name of the document I using with
Word to another external process.
I did an Add-in that can start an external process, but I can't get the name
of the document I using.
Can you help me?
thanks
dev
2007-04-17 18:58:01 UTC
Permalink
Thank you for the reply.

I mean my custom application written in Java. I need to put the name of the
document as an input parameter.
for example:

java mainclass documentName

I can start my application "java mainclass" but I need to put the parameter.
thank you again
Post by Perry
What do you mean "external process"?
Do you mean
- another Office application?
- another application? If so, what?
Perry
2007-04-17 20:53:17 UTC
Permalink
One way:
Store the filename in a textfile.
You can retrieve the filename by reading this textfile in the other app.

--
Krgrds,
Perry

System:
Vista/Office Ultimate
VS2005/VSTO2005 SE
Post by dev
Thank you for the reply.
I mean my custom application written in Java. I need to put the name of the
document as an input parameter.
java mainclass documentName
I can start my application "java mainclass" but I need to put the parameter.
thank you again
Post by Perry
What do you mean "external process"?
Do you mean
- another Office application?
- another application? If so, what?
dev
2007-04-17 21:20:04 UTC
Permalink
My problem is that I don't know how to get the name of the document opened.

How can I get the file name of the opened document?

For example
The user opened the file named "myTest.doc" and, clicking on a Custom button
of the Add-in, the Add-in have to put the string "myTest.doc" in some place.
How can I get that string in vb?

thank you very much.
Perry
2007-04-17 21:35:18 UTC
Permalink
If "myTest.doc" is the active document in the active Word session you could
go:
Dim sFullFileName As string
sFullFileName = ActiveDocument.FullName

or if you have an object variable [MyDoc] pointing to document "myTest.doc"
Dim sFullFileName As string
sFullFileName = MyDoc.FullName

Write sFullFileName to a textfile and you can read it in the other app.

--
Krgrds,
Perry

System:
Vista/Office Ultimate
VS2005/VSTO2005 SE
Post by dev
My problem is that I don't know how to get the name of the document opened.
How can I get the file name of the opened document?
For example
The user opened the file named "myTest.doc" and, clicking on a Custom button
of the Add-in, the Add-in have to put the string "myTest.doc" in some place.
How can I get that string in vb?
thank you very much.
dev
2007-04-18 08:38:01 UTC
Permalink
At first, I wanna thank you for your support.

So, I if put that code in che onConnection method, I have one error becouse
VS don't know "ActiveDocument", "ActiveDocument don't declared" and I can't
build the project.

I used this code becouse unfortunally I have not [MyDoc] object.
Post by Perry
Dim sFullFileName As string
sFullFileName = ActiveDocument.FullName
thank u again.
Post by Perry
If "myTest.doc" is the active document in the active Word session you could
Dim sFullFileName As string
sFullFileName = ActiveDocument.FullName
or if you have an object variable [MyDoc] pointing to document "myTest.doc"
Dim sFullFileName As string
sFullFileName = MyDoc.FullName
Write sFullFileName to a textfile and you can read it in the other app.
--
Krgrds,
Perry
Cindy M.
2007-04-23 13:33:56 UTC
Permalink
Hi =?Utf-8?B?ZGV2?=,
Post by dev
So, I if put that code in che onConnection method, I have one error becouse
VS don't know "ActiveDocument", "ActiveDocument don't declared" and I can't
build the project.
I used this code becouse unfortunally I have not [MyDoc] object.
Post by Perry
Dim sFullFileName As string
sFullFileName = ActiveDocument.FullName
ActiveDocument is a property of the Application object. You have to start have
a variable assigned to the Word.Application, for example wdApp:
wdApp.ActiveDocument.FullName

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)

Loading...