473,395 Members | 1,677 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How do I get rid of multiple instances of Word

LegalIT
15
Hello,

I have a VB.net application that creates reports from database information. I am able to create the reports fine. The problem is each time I create a report my application starts a new instance of Word instead of just adding a document to the current application. I use the following code to create each report. If I take the New out I get an error.

Dim objWord As New Word.Application
objWord.Visible = True
objWord.Documents.Add()
objWord.Selection.TypeText("Report Created - " & Now())
...
objWord = Nothing

Anyone know how I create multiple Word reports without creating multiple instances of Word?

Thanks!
LegalIT
Aug 7 '08 #1
2 1646
kadghar
1,295 Expert 1GB
First of all, i'd recomend you to create only one word instance, the first time, later times just call it

Expand|Select|Wrap|Line Numbers
  1. dim obj1 as object
  2. Sub bla_bla()
  3. set obj1 = createobject("word.application")
  4. 'your code for new reports
  5. end sub
this way you'll only have one instance.

Now, if you dont have many instances at the same time, just dont close it
and make it visible (as you have allready done) and leave it opened, then simply close it the normal way, by clicking the upper right button.

This issue has been discused many many times around here, and for some reason, most of the solutions just dont aply to all users. So leaving the instance visible and open, and closing it manualy is the 'for sure' way of getting rid of it.

HTH
Aug 7 '08 #2
LegalIT
15
Thank you for your suggestion. It worked great!
Aug 12 '08 #3

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

Similar topics

1
by: Martin V. | last post by:
Hello, Is the multiple instances capability of SQL2K mature enough for a Production system? We're looking at upgrading our hardware but the proposed solution calls for consolidating two...
3
by: Voetleuce en f?nsievry | last post by:
G'day I'm looking for a script that can search multiple instances of Google (or other search engines optionally). The user types in a single word in the text field, presses ENTER or the submit...
4
by: seven | last post by:
This might be a newbie question or otherwise easy stuff for some of you, but it's tweaking me ... can't seem to get it to work right. I am working with a script that basically creates two arrays,...
0
by: Bill Brinkworth | last post by:
it's would be simple in Access, but seems to be harder in VB. I want to enter part of a word and search an access table, and display all instances of words containing those letters in a box (say a...
16
by: juglesh | last post by:
Hello, I need to look through the text on a page and replace certain words with an image or other word something like: read document find all instances of the word "blah" change all...
6
by: Chris Tyson | last post by:
I created an Access 97 database a while ago. It is protected by Workgroup Security, and it is not split. In order to compare different sets of results, a colleague has suggested that it would be...
2
by: Helen Trim | last post by:
I have an application with three forms that are msde visible and activated when needed. It uses Word to open documents and one of the forms is opened as the Word document is closed in the...
7
by: Dave | last post by:
Apologies for the newbie question. I have created a vb.net program for my company that is designed to work with Word Templates (about forty of them that we commonly use) that are selected by the...
6
by: Bob Alston | last post by:
Looking for someone with experience building apps with multiple instances of forms open. I am building an app for a nonprofit organizations case workers. They provide services to the elderly. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.