Hi there
I have a problem with winword.exe on my server. i have an asp page which populate a word template on my web server using bookmarks which works fine
but for some reason it does not close the winword.exe on the server after the document has been populated and saved and i end up with lot of these running in the server taskmanager which i have to close down manually what make this even stranger is that when i test it on my laptop the winword.exe are close after the page has ran
please see my code below
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!-- #INCLUDE FILE = "../../DB/DBConnect.asp" -->
<% Session.LCID = 2057 %>
<%
On error Resume Next
Server.ScriptTimeout = 100000
Dim PrimKey
PrimKey = Request.QueryString("PrimKey")
Dim rs
set rs = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT * FROM tbl_ASR " & _
"WHERE PrimKey = '" & PrimKey & "';"
rs.Open SQL,objConn,2,3
Dim FileName
FileName = rs("FirstName") & "_" & rs("Surname") & "_" & rs("Payroll") & "_" & rs("CostCentre")
Dim wdApp
set wdApp = Server.CreateObject("Word.Application")
'Server
wdApp.visible = true
Dim wdDoc
strPath = Server.MapPath("\Transactional_Services\Subsites\A SR\Template\ASR.dot")
set wdDoc = wdApp.documents.open (strPath)
If wdDoc.Bookmarks.Exists("Name") Then
wdDoc.Bookmarks("Name").Range.Text = " " & rs("FirstName") & " " & rs("Surname")
End IF
If wdDoc.Bookmarks.Exists("JobTitle") Then
wdDoc.Bookmarks("JobTitle").Range.Text = " " & rs("JobTitle")
End IF
If wdDoc.Bookmarks.Exists("PayrollNumber") Then
wdDoc.Bookmarks("PayrollNumber").Range.Text = " " & rs("Payroll")
End IF
If wdDoc.Bookmarks.Exists("Directorate") Then
wdDoc.Bookmarks("Directorate").Range.Text = " " & rs("Directorate")
End IF
If wdDoc.Bookmarks.Exists("Location") Then
wdDoc.Bookmarks("Location").Range.Text = " " & rs("Location")
End IF
If wdDoc.Bookmarks.Exists("CostCentre") Then
wdDoc.Bookmarks("CostCentre").Range.Text = " " & rs("CostCentre")
End IF
wdDoc.saveas Server.MapPath("\Transactional_Services\Subsites\A SR\ASR_Documents\" & FileName & ".doc")
wdDoc.Quit
wdDoc.Close
Set wdDoc = Nothing
wdApp.Quit
wdApp.Close
Set wdApp = Nothing
rs.close
objConn.close
set rs = Nothing
set objConn = Nothing
Response.Redirect("ASR_Documents/" & FileName & ".doc")
%>
If any body can give me any hint tip or knows how to solve this problem PLEASE HELP