I'm Opening Word Document With This Code
Dim missing As Object = System.Reflection.Missing.Value
Dim fileName As Object = "c:\a.doc"
Dim newTemplate As Object = False
Dim docType As Object = 0
Dim isVisible As Object = True
Dim WordApp As New Word.ApplicationClass()
Dim aDoc As Word.Document = WordApp.Documents.Add(fileName, newTemplate, docType, isVisible)
WordApp.Visible = False <------*****
aDoc.Activate()
aDoc.PageSetup.TopMargin = 10
aDoc.PageSetup.BottomMargin = 40
WordApp.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft
WordApp.Selection.Font.Bold = CInt(Word.WdConstants.wdToggle)
I Want to Close Some Word Process .
When i Use This Code To Close Process Of Word I have 1 Problem
Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName("WINWORD")
For Each p As Process In pProcess
p.Kill()
Next
If i Opened Word File Manualy
With That Code All Off Word Document Is Closed But I Want To Closed Only Word Process That Create With VbCode In RunTime.
Please Help Me That What Am i Must To Do?
[Modified: First, thank you for using pre tags. But, you have to be careful with them when you paste code in. Sometimes, it recognizes it as code and places the pre tags there for you. So, if you've already put them in, and then paste code, you get two pre tags, which screws up the formatting]
At End Of My Work I Used This
WordApp.Close() or aDoc.Close()
But I Open That Word File With WebBrowser And Want To Close Some Word Process But I Don't Know How Can I Find ?
Please Attention To That
WordApp.Visible = False
And I Can't To Close It Normaly.
I must Close It With Kill Process.