Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Thu, 20 Sep 2007 14:16:55 -0000,    group: microsoft.public.word.vba.addins        back       


Open a word document from addin   
I'm sorry to ask this totally lame question, but i cannot find any
documentation. I have written an addin that works as an ftp client,
and i would like the addin to be able to open a word document by
double clicking that item in one of my listviews. I am working with
Word in office 2007,  VS2005, VSTO2005, and the PIA's, and coding in
c#.
Thankyou in advance
-Rob
date: Thu, 20 Sep 2007 14:16:55 -0000   author:   unknown

Re: Open a word document from addin   
Hi

You need the Documents.Open method.

In VBA it would be something like:

Sub OpenDocument()

Dim sPFN As String
Dim oDoc As Word.Document
Dim wdApp as word.Application

    'Get a reference to a Word application
    set wdApp = where ever you're getting that from

    'Get the path and file name from somewhere
    sPFN = "C:\My folder\My subfolder\MyDocument.doc"

    'Open the document
    Set oDoc = wdApp.Documents.Open(FileName:=sPFN)

    'You can now do stuff to the document


End Sub

You'll need to translate to C# and add appropriate error checking.

There are many parameters to the .Open method - look up Word VBA help for 
the full details.

Hope this helps.

Shauna Kelly.  Microsoft MVP.
http://www.shaunakelly.com/word


 wrote in message 
news:1190297815.262629.54780@i38g2000prf.googlegroups.com...
> I'm sorry to ask this totally lame question, but i cannot find any
> documentation. I have written an addin that works as an ftp client,
> and i would like the addin to be able to open a word document by
> double clicking that item in one of my listviews. I am working with
> Word in office 2007,  VS2005, VSTO2005, and the PIA's, and coding in
> c#.
> Thankyou in advance
> -Rob
>
date: Fri, 21 Sep 2007 21:32:19 +1000   author:   Shauna Kelly

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us