473,706 Members | 6,613 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating more Winword processes

Hi everybody,

I'm encountering some problem in trying to activate more than one
instance of Word from C#.
To keep it simple, I have a stupid Form, with just a button in it and
the following code:

private void button1_Click(o bject sender, System.EventArg s e)
{
Word.Applicatio nClass w1 = new Word.Applicatio nClass();
w1.Visible = true;
Word.Applicatio nClass w2 = new Word.Applicatio nClass();
w2.Visible = true;
}

When I click on the button I end up (as expected) with two winword
processes in the task manager, and two word windows on the screen.
But when I try to close the second Word, a MessageBox appears telling
me that Normal.dot is used by another user or application. When I press
OK a FilDialog appears asking me for a name to save the Normal.dot. I
press Cancel in this Dialog and nothing happens. If I try again to
close Word, another Dialog appears, stating that Normal.dot has been
modified and asking me if I want to save it. When I say No, Word
finally agrees to close.

Can you explain this strange (at least to me) behavior?

Thank you so much,
Francesco.

Feb 1 '06 #1
1 1757
hello, i can't explain it but i maybe have a solution :

add this just after your code
w2.DisplayAlert s = False;

all errors should be hidden
;)

"Paguro Bernardo" wrote:
Hi everybody,

I'm encountering some problem in trying to activate more than one
instance of Word from C#.
To keep it simple, I have a stupid Form, with just a button in it and
the following code:

private void button1_Click(o bject sender, System.EventArg s e)
{
Word.Applicatio nClass w1 = new Word.Applicatio nClass();
w1.Visible = true;
Word.Applicatio nClass w2 = new Word.Applicatio nClass();
w2.Visible = true;
}

When I click on the button I end up (as expected) with two winword
processes in the task manager, and two word windows on the screen.
But when I try to close the second Word, a MessageBox appears telling
me that Normal.dot is used by another user or application. When I press
OK a FilDialog appears asking me for a name to save the Normal.dot. I
press Cancel in this Dialog and nothing happens. If I try again to
close Word, another Dialog appears, stating that Normal.dot has been
modified and asking me if I want to save it. When I say No, Word
finally agrees to close.

Can you explain this strange (at least to me) behavior?

Thank you so much,
Francesco.

Feb 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1025
by: Tony Roost | last post by:
I have created a test VB.Net form that will use MS Word to check the spelling of text in an input box The test application runs without a problem and I quit the word application at the end of the spell check. However, the application is leaving a trail of winword.exe processes running on the system PC is running W2000 SP The code and details of the form are detailed below. If anybody has any ideas about a word around or another way to add...
16
9771
by: Asaf | last post by:
I am trying to create and use a COM object with C#.NET 2005. The assembly is set to "Register for COM interop" but when I am trying to call it from VB on Word 2003 I am getting this error: Run-time error '-2147024894 (80070002)': File or assembly name COMTest3, or one of its dependencies, was not found. The code for the COM:
3
4053
by: James | last post by:
Howdy. I'm having difficulty getting winword.exe processes to die on our development server when using SET objWord = CreateObject("word.application") from an .ASP page. This problem exists on our development server only as we are still using Office 2000 components in production. No probs in production with the current code which has been in use for a couple of years now.
2
2799
by: Dean Slindee | last post by:
Using this statement to utilize the spell checker in WinWord: WinOffice.clsWord.SpellChecker(txtNote.Text) 'this does not work because no main window is displayed 'Dim proc = Process.GetProcessesByName("winword") 'For i As Integer = 0 To proc.Count - 1 ' proc(i).CloseMainWindow() 'Next i 'this closes all WinWord processes silently (a little overkill):
0
8780
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
9285
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9155
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
9049
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
8989
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
6614
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
4445
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
3145
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
2092
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.