arunendra
May 20th, 2005, 10:53 AM
I've used bookmarked msword from my vb application to print documents.
after printing
Dim wordapp As New Word.Application
Dim thisdoc As New Word.Document
Set wordapp = Nothing
Set thisdoc = Nothing
Set thisdoc = wordapp.Documents.Open("D:\I B A PRODUCT\Manual Joining Letter.doc", ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", Format:=wdOpenFormatAuto)
'temp_name comes from a database table
If thisdoc.Bookmarks.Exists("name1") = True Then
thisdoc.Bookmarks("name1").Select
' wordapp.ActiveDocument.Bookmarks("name1").Start
wordapp.Selection.TypeText temp_name
End If
wordapp.ActiveDocument.PrintOut Range:=wdPrintCurrentPage
intmsg = MsgBox("Did the document print correctly", vbYesNo)
If intmsg = vbNo Then
intmsg = MsgBox("Do you want to try again printing join details?", vbYesNo)
If intmsg = vbYes Then
wordapp.Documents.Close (wdDoNotSaveChanges)
wordapp.Quit
end if
but after certain no of printing windows virtual memory becomes low as i can see in the task manager several no of winword.exe which are feeling up the memory.
Is there any way to free memory and destroy winword.exe from memory as soon as the printing is complete!
after printing
Dim wordapp As New Word.Application
Dim thisdoc As New Word.Document
Set wordapp = Nothing
Set thisdoc = Nothing
Set thisdoc = wordapp.Documents.Open("D:\I B A PRODUCT\Manual Joining Letter.doc", ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", Format:=wdOpenFormatAuto)
'temp_name comes from a database table
If thisdoc.Bookmarks.Exists("name1") = True Then
thisdoc.Bookmarks("name1").Select
' wordapp.ActiveDocument.Bookmarks("name1").Start
wordapp.Selection.TypeText temp_name
End If
wordapp.ActiveDocument.PrintOut Range:=wdPrintCurrentPage
intmsg = MsgBox("Did the document print correctly", vbYesNo)
If intmsg = vbNo Then
intmsg = MsgBox("Do you want to try again printing join details?", vbYesNo)
If intmsg = vbYes Then
wordapp.Documents.Close (wdDoNotSaveChanges)
wordapp.Quit
end if
but after certain no of printing windows virtual memory becomes low as i can see in the task manager several no of winword.exe which are feeling up the memory.
Is there any way to free memory and destroy winword.exe from memory as soon as the printing is complete!