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
Shauna Kelly - 21 Sep 2007 12:32 GMT
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
> 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,
[quoted text clipped - 4 lines]
> Thankyou in advance
> -Rob