Group:  Microsoft Word ยป microsoft.public.word.vba.addins
Thread: Word Addin How can I select the using file?

Word Addin How can I select the using file?
dev 4/17/2007 4:02:05 PM
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
Re: Word Addin How can I select the using file?
"Perry" <drumper[ at ]gmail.com> 4/17/2007 6:36:16 PM
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



"dev" <dev[ at ]discussions.microsoft.com> schreef in bericht
news:69A65D59-572E-40DA-A5C9-100A2390D161[ at ]microsoft.com...
[Quoted Text]
> 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

Re: Word Addin How can I select the using file?
dev 4/17/2007 6:58:01 PM
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


"Perry" wrote:

[Quoted Text]
> What do you mean "external process"?
>
> Do you mean
> - another Office application?
> - another application? If so, what?
>
>
Re: Word Addin How can I select the using file?
"Perry" <drumper[ at ]gmail.com> 4/17/2007 8:53:17 PM
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



"dev" <dev[ at ]discussions.microsoft.com> schreef in bericht
news:5B812791-D4BA-40ED-9371-4AE281BD9309[ at ]microsoft.com...
[Quoted Text]
> 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
>
>
> "Perry" wrote:
>
>> What do you mean "external process"?
>>
>> Do you mean
>> - another Office application?
>> - another application? If so, what?
>>
>>

Re: Word Addin How can I select the using file?
dev 4/17/2007 9:20:04 PM
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.
Re: Word Addin How can I select the using file?
"Perry" <drumper[ at ]gmail.com> 4/17/2007 9:35:18 PM
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



"dev" <dev[ at ]discussions.microsoft.com> schreef in bericht
news:E946E34C-82F6-4059-BF28-75E7E6F02982[ at ]microsoft.com...
[Quoted Text]
> 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.

Re: Word Addin How can I select the using file?
dev 4/18/2007 8:38:01 AM
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.

[Quoted Text]
> Dim sFullFileName As string
> sFullFileName = ActiveDocument.FullName

thank u again.




"Perry" wrote:

> 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
>
Re: Word Addin How can I select the using file?
Cindy M. <C.Meister-C[ at ]hispeed.ch> 4/23/2007 1:33:56 PM
Hi =?Utf-8?B?ZGV2?=,

[Quoted Text]
> 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.
>
> > 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 :-)

Home | Search | Terms | Imprint
Newsgroups Reader