473,804 Members | 4,269 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

1 New Member
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_Cl ick()
Dim myfile
myfile = dir(MTM_INIT_LE TTER*.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_containe r.OLETypeAllowe d = acOLEEmbedded
Me.doc_containe r.SourceDoc = myfile
If Me.doc_containe r.Visible <> True Then
Me.doc_containe r.Visible = True
End If
Me.doc_containe r.Action = acOLECreateEmbe d
Me.doc_containe r.SizeMode = acOLESizeStretc h
Me.doc_containe r.Visible = True
Me.doc_containe r.Verb = acOLEVerbInPlac eUIActivate
Me.doc_containe r.Verb = acOLEVerbShow
Me.doc_containe r.Action = acOLEActivate
End Sub

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

Me.doc_containe r.Visible = False
Me.doc_containe r.SourceDoc = ""
Me.doc_containe r.Object.Applic ation.Quit
Me.doc_containe r.Action = acOLEClose

End Sub
Jan 8 '08 #1
1 2091
kadghar
1,295 Recognized Expert Top Contributor
... 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_containe r.Visible = False
Me.doc_containe r.SourceDoc = ""
Me.doc_containe r.Object.Applic ation.Quit
Me.doc_containe r.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

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

Similar topics

8
5160
by: Darryl Kerkeslager | last post by:
I hope that although this is 25% Access and 75% Word, that someone will know ... The whole problem here arises because 1) Microsoft acknowledges an 'issue' wherein TextInput type FormFields are lost when doing a MailMerge and 2) the fix that they have proposed is both inadequate and won't work from Access. http://support.microsoft.com/?kbid=286841 The part of the code below that actually performs the merge is great; the core of it is...
6
2684
by: Ryan Muller | last post by:
My company just upgraded from Access 97 to Access 2003 today and we are having some issues in a database that generates a Word document from information selected in a form. Here is the code we were using without issue previous to the switch: 'Start Word and create a new doc from the template Set objWord = CreateObject("Word.Basic") objWord.AppMaximize "Microsoft Word", 1 objWord.FileNew Template:=StrTemplPath & "letter.dot"
6
1584
by: BBM | last post by:
Hi, I'm having trouble getting control data binding to work. As I understand it, the simplest form of databinding requires three things: 1) A control (say a textbox) on a form or user control, 2) A field or object.member to which you want to bind, 3) A "Binding" object that connects the variable to a property of the control ("Text" for example).
4
7688
by: Daniel | last post by:
Hello, i have a problem with the word automation from c#. First, i want to mention, that i don't have any dependencies from word in my c#-project, i want to use the system.reflection model to handle the automation. So, i'm using the following code to create a new word document: ---Code---
3
3465
by: John Smith | last post by:
Hey folks, I've got a Windows C# application that generates a .doc file and then allows the user to preview it. I generate the file using the StreamWriter class and do a flush() and a close() after writing the last line (which always get runned). Because the intended users have all versions of MS Word ranging from Word 97 to 2003, I chose not to go with a dll object modeling approach and instead
10
4031
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the application. What should happen, is that the main MDI form should close, taking the child forms with it. There is code to loop through the child forms, remove the controls on each of them, and then close the form, but this code should execute only...
4
8859
by: Macbane | last post by:
Hi, I have a 'main' form called frmIssues which has a subform control (named linkIssuesDrug) containing the subform sfrmLink_Issues_Drugs. A control button on the main form opens a pop-up form which allows me to edit the record in the subform. What I want to happen is for subform with the new edits to be updated on the main form when I close the popup. I'm sure this is a very small bit of code in the the 'On close' event for the popup...
2
4884
by: Derek Hart | last post by:
I am using late bound Microsoft Word integration with a vb.net winforms application. If I run code such as the following: Dim objWord As Object Dim objWrdDoc As Object Dim count As Integer Dim filename As String filename = "c:\temp\mergedata\1.doc" objWord = CreateObject("Word.Application") For count = 1 To 10000
5
9796
by: sphinney | last post by:
Basic question: Does anyone know how to go about adding a control to an Access 2007 form that will allow viewing a Word 2007 document? Reason for asking: My office is about to receive 100+/- Word 2007 documents that contain data that needs to be imported into various fields of an Access 2007 table. To facilitate the import process, I was thinking of creating a form in Access that would have a Word control (or "window") at the bottom of the...
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10076
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7616
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4297
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.