Visual Studio Development Bookmark and Share   
 index > Visual Studio Tools for Office > winword.exe remains running after used
 

winword.exe remains running after used

1DimAAsNewWord.Application
2DimDAsWord.Document=A.Documents.Add
3DimPAsWord.Paragraph=D.Content.Paragraphs.Add
4P.Range.Text="line1"
5P.Range.InsertParagraphAfter()
6P=D.Content.Paragraphs.Add
7P.Range.Text="line2"
8P.Range.InsertParagraphAfter()
9D.Save()
10
11Marshal.ReleaseComObject(P)
12P=Nothing
13D.Close()
14Marshal.ReleaseComObject(D)
15D=Nothing
16A.Quit()
17Marshal.ReleaseComObject(A)
18A=Nothing

I'm trying to automate Word but after I'm done winword.exe doesn't terminate. What am I doing wrong?

Jon Law  Friday, January 30, 2009 1:45 AM

the VSTO forum supports the VSTO technology. As VSTO runs in-process with an Office application, instantiation and release of that application and its objects is not a supported topic, although you may find the odd discussion about it. However, the correct place to ask such questions is the office.developer.automation newsgroup. You'll find a link to that, and other venues for non-VSTO, Office-related questions in the forum's Please Read First message. For this question, I recommend the office.developer.automation newsgroup.

Right off-hand, in your code snippet, I'd say the problem is that you're trying to save a new document. Doing that will trigger the Save As dialog box, blocking Word until that dialog box is answered. Use D.SaveAs and specifiy a file location + name and your code should run...

I very much recommend that you make your Word.Application Visible while developing/testing. Especially if you're not familiar with the object model. That way you can see things like this.


Cindy Meister, VSTO/Word MVP
Cindy Meister  Friday, January 30, 2009 8:31 AM

the VSTO forum supports the VSTO technology. As VSTO runs in-process with an Office application, instantiation and release of that application and its objects is not a supported topic, although you may find the odd discussion about it. However, the correct place to ask such questions is the office.developer.automation newsgroup. You'll find a link to that, and other venues for non-VSTO, Office-related questions in the forum's Please Read First message. For this question, I recommend the office.developer.automation newsgroup.

Right off-hand, in your code snippet, I'd say the problem is that you're trying to save a new document. Doing that will trigger the Save As dialog box, blocking Word until that dialog box is answered. Use D.SaveAs and specifiy a file location + name and your code should run...

I very much recommend that you make your Word.Application Visible while developing/testing. Especially if you're not familiar with the object model. That way you can see things like this.


Cindy Meister, VSTO/Word MVP
Cindy Meister  Friday, January 30, 2009 8:31 AM

You can use google to search for other answers

Custom Search

More Threads

• Delpoyment with dependency assemblies
• Excel BeforeRightClick TransparentProxy
• Features or Bugs in VSTO.
• is it possible to make a CustomTaskPanes appear always on the top when playing the slideshow.
• How to create Winform program with VSTO
• Problem deploying a dll in VSTO2008
• Charts in VSTO Word
• Get user working time from the Exchange Server\Outlook 2003
• Form Region SAve Event
• VB Runtime Error '5' in C# Program