By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,968 Members | 1,589 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,968 IT Pros & Developers. It's quick & easy.

ms word still running after closing the bound control object in an access form

P: 1
I am using a bound control to embed word documents within an access form.
I have created two buttons on the form One to embed aand display and one to close.
I embed one doc and then save the doc and close bound control then open the next doc.
Each time I open the doc an instance of winword is opened in the background, however,
when I close the bound control object (doc_container) the winword instance is not closed and is
still running. So if I run this prcoess for 20 times I will have 20 instancers of winword running
in the background. How should I stop the winword process each time I close the bound control.
Here is the code
' This sub opens and displays a new doc each time
Private Sub Start_review_Click()
Dim myfile
myfile = dir(MTM_INIT_LETTER*.doc")

If myfile = "" Then 'init letter for member has not yet been created
MsgBox "There are no more member letters available for review."
Exit Sub
End If

'assign doc to bound control
Me.doc_container.OLETypeAllowed = acOLEEmbedded
Me.doc_container.SourceDoc = myfile
If Me.doc_container.Visible <> True Then
Me.doc_container.Visible = True
End If
Me.doc_container.Action = acOLECreateEmbed
Me.doc_container.SizeMode = acOLESizeStretch
Me.doc_container.Visible = True
Me.doc_container.Verb = acOLEVerbInPlaceUIActivate
Me.doc_container.Verb = acOLEVerbShow
Me.doc_container.Action = acOLEActivate
End Sub

' This sub closes the bound control
Private Sub Review_complete_Click()
Dim mydoc As String

Me.doc_container.Visible = False
Me.doc_container.SourceDoc = ""
Me.doc_container.Object.Application.Quit
Me.doc_container.Action = acOLEClose

End Sub
Jan 8 '08 #1
Share this Question
Share on Google+
1 Reply


kadghar
Expert 100+
P: 1,295
... embed one doc and then save the doc and close bound control then open the next doc.
Each time I open the doc an instance of winword is opened in the background, however,
...
Me.doc_container.Visible = False
Me.doc_container.SourceDoc = ""
Me.doc_container.Object.Application.Quit
Me.doc_container.Action = acOLEClose

End Sub
yeah, i know what you mean. I dont know if there's an easy way to close that instance, but what have worked for me so far is to make it visible before you close it, say:

Expand|Select|Wrap|Line Numbers
  1. me.doc_container.object.visible=true
  2. me.doc_container.object.application.quit
It'll produce a little flash on the screen. so in order to avoid that, try making the object a public one. so you just open it at the begining, then open and close as many docs as you need, and at the end make it visible and close it.
HTH
Jan 9 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.