Hi Friends,
In my scenario am opening the WordDocument programatically,suppose if i'am opening the same worddocument i should prompt the message that the document is already opened ..
Process[] pro = Process.GetProcessesByName("WINWORD");
if (pro.Length > 0)
{
foreach (Process p in pro)
{
p.kill();
}
}
i'am using the above code to find the process and killing already opened documents, the problem is its killing the wordexe so that all the other opened documents also destroyed.. so how to find the name of the document and close particular documents only..
i used "P.MainWindowTitle" to get the opened document name but its not showing all the opened documents rather showing the first opened document name.
Please suggest me the solution ..
thanks in advance
Dev..
Sam HobbsPosted Apr 18, 2011, 6:14 PM
If there is any reason you can't use the instance of the document that resulted from opening it using interop, then you can get the document from the ROT. Do you need to do that? It is easy; you can get it in just one line of code, but you will probably use two to put the filename in a separate line. Then another line to close the document.
So which of the two
do you want to do?
VulpesPosted Apr 18, 2011, 4:03 PM
Suthish NairPosted Apr 18, 2011, 3:21 PM
VulpesPosted Apr 18, 2011, 10:23 AM
Karthikeyan AnbarasanPosted Apr 18, 2011, 6:20 AM
http://www.vbforums.com/showthread.php?t=549506