Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() WordApp.Quit Set WordApp = Nothing -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) "Edmund" wrote in message My main proc in Excel calls the below sample sub proc (which uses Word VBA), each time main proc runs. However, I realize Windows Task Manager seem to display many instances of "WINWORD.EXE" even after I close & exit Excel Application. How can I close "WINWORD.EXE" each time sub proc ends? Sub MainProc() Call SaveACopyToLocal_Fix_CRLF_UNIX_Bug(iFN:=iPath & "\" & iFN_isbp004, iReadOnly:=True, iFormat:=0, iEncoding:=1252, oFN:=oPath & "\" & oFN_isbp004, oFileFormat:=2, oAddToRecentFiles:=True, oEncoding:=437, oLineEnding:=0) End Sub Private Sub SaveACopyToLocal_Fix_CRLF_UNIX_Bug(iFN As String, iReadOnly As Boolean, iFormat As Integer, iEncoding As Integer, oFN As String, oFileFormat As Integer, oAddToRecentFiles As Boolean, oEncoding As Integer, oLineEnding As Integer) Dim WordApp As Object Set WordApp = CreateObject("Word.Application") On Error GoTo ErrorHandler: With WordApp .Documents.Open Filename:=iFN, ReadOnly:=iReadOnly, Format:=iFormat, Encoding:=iEncoding .ActiveDocument.SaveAs Filename:=oFN, FileFormat:=oFileFormat, AddToRecentFiles:=oAddToRecentFiles, Encoding:=oEncoding, LineEnding:=oLineEnding .Documents(oFN).Close False End With Set WordApp = Nothing Exit Sub ErrorHandler: Msg = "Please ensure that you are properly connected to the server " & vbCrLf Msg = Msg & "before attemting to rerun this application. " MsgBox Msg, vbCritical, APPNAME & " (UNABLE TO CONTACT SERVER)" End Sub Thanks -- Edmund (Using Excel 2003) |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
running proc in excel | Excel Discussion (Misc queries) | |||
executing stored proc from Excel | Excel Programming | |||
Paste in WinWord, problems with several processes | Excel Programming | |||
Open Winword from Excel | Excel Programming | |||
Open Winword-file using a Excel 97 VBA macro | Excel Programming |