Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launch Word Files as Seperate Processes 1

Status
Not open for further replies.

mephano

Technical User
Dec 9, 2010
6
US
Since switching to 2010, I have been plagued with the poor performance issues.

Now, Microsoft has seen fit to run all files in the same process. As a technical writer, I frequently have several documents open at one time. If one locks up, they all lock up. If one crashes, they all crash.

With IE, each open window is listed as a seperate process in Task Manager and if a window freezes, you can easily kill the process. I am looking for a way to be able to do the same thing in Word. That way if one document locks up I can still do something with the others.

Some of the documents I access are local, some are on the network, but most are through SharePoint.

If it matters, I am on Win 7 Enterprise 64-bit with 4 GB RAM. I am using MS Office Professional Plus 2010.

Does anyone have any idea how this can be done?
 
By declaring, Set-ing, and using, separate instances of Word. Other than that you are going to have to give more details of what you want.

Can you make multiple instances of Word. Sure. Is it a good idea? Generally speaking, no.

I also am a professional technical writer. I also have multiple documents open. I do not have the issue you describe.

However, again, if you want to - yes, you can have separate instances of Word, one for each document.


unknown
 
The problem is more serious with table-heavy documents. Of course, Word has always had problems with that. It would increase my productivity if I could move to another document while the current one is locked up for whatever reason. But since they are all in the same process, when one is frozen they are all frozen (and since I use Word aws my Outlook email editor, that gets locked up too.) Microsoft resolved this issue in IE by splitting out each window in its own process. What are the steps to accomplish this in Word 2010 and why would you say it isn't a good idea?
 

mephano,

I have the same issues with Excel.
The only way I've found is to open Excel first, then the document. Every time I need another document open, I open Excel first. This will also work with Word.

In earlier versions of Word and Excel, I think there was an option to open in separate instances, but I cannot find it in 2007.

Randy
 
Hi Randy,

I've tried that and it doesn't seem to work in 2010. I heard a "rumor" that it can be done, but that it makes the entire system unstable. But the rumor was lacking in substantive data and I have been unable to determine its veracity.
 
Like I stated.

Make separate instances of Word.
Code:
Sub NewOne()
Dim AnotherWord As Word.Application
Set AnotherWord = CreateObject("Word.Application")
AnotherWord.Visible = True
End Sub
AnotherWord is a completely different instance from the one the sub was executed in. You can use it like a separate Word...because it is a separate Word. You can see in Task Manager there are now two WINWORD.EXE

This is nothing different in 2010 (I think).

Why do I say this is not generally a good idea?

Because each instance takes up its own resources. And with Word, that is NOT an insignificant issue. Plus Word is still not the most polite application regarding release of memory. Multiple instances of Word could have complications.

For one thing, if you have, say:

Contact.doc in the first instance, and YaddaBlah.doc in the second.

If you execute:
Code:
Sub ListAllDocs()
Dim msg As String
Dim aDoc As Document
For Each aDoc In Documents()
   msg = msg & aDoc.Name & vbCrLf
Next
MsgBox msg
End Sub
You get different results depending on which instance (or more accurately which document is currently active) is being used.

If you have Contacts.doc active you do NOT get YaddaBlah.doc listed as a document. There are separate Documents collections. This is quite correct as you have different instances.

I would predict that unless you carefully made sure to release the memory for any given instance, it would pile up in a mess. If you want to pass any data between the instances you will have to use document objects.


unknown
 
Oh, and each instance uses the same instance of normal.dot.

That can lead to issues as well.

Say you close a file in one instance by closing Word. If Word thinks it needs to save normal, it can NOT do so, as it is "being used by another application" - the other instance.

This may or may not be a problem.


unknown
 
Fumei,

Thanks for your response. Unfortnuately, I have no idea how to do what you are saying to do. Where do I go and what do I do? I am, not a programmer or software engineer. Execute how and where?
 
Oh. Well really, if you are going to start messing around with separate instances of an application, you would best do some research on what you are getting into.

If you think you have memory issues now, if you end up with multiple instances of Word, and you do not release them correctly, I guarantee you will have issues.

Here is the code again;
Code:
Sub ListAllDocs()
Dim msg As String
Dim aDoc As Document
For Each aDoc In Documents()
   msg = msg & aDoc.Name & vbCrLf
Next
MsgBox msg
End Sub
This is a procedure, and it can be in any code module - ummmmm, do you know how to get in the Visual Basic Editor? Let's assume you do.

Put the procedure into any code module. If you are going to be using it generally, then put it in your Normal.dot. For other reasons this is a bad place, but I am afraid if I explain why it will confuse you.

This procedure can be executed "manually", in the VBE. However, I will also assume you want to make a new instance of Word by way of a button to click, or a menu item, or a keyboard shortcut. All three of these routes are available to you.

Using whatever route you want, you fire the procedure.

And....a new separate instance of Word is created. It will be comepletely independent of the instance you were in when you executed the procedure. You can switch (using the taskbar, or Alt-Tab) to this new instance and open a document.

OR...you can programmatically use it to open other documents. These documents will be separate from the other instance.

A point though. You states most are in Sharepoint. This brings up a bit of problem. If you are in Sharepoint and open a Word document, making you own instance of Word will NOT help. Sharepoint uses the current instance. I think. I do not know of a way to select a different instance of Word coming from Sharepoint.

This, and other reasons, is why I dislike Sharepoint.




unknown
 
Fumei,

Thanks for the additional detail. In Sharepoint, you can view files in an Explorer window and click there to open. You can also open Word and then navigate to the network location of the Sharepoint file using the "open file" dialog, so the procedure would not really be balked by Sharepoint.

However, as I said I am not a programmer. So no I don't know how to get to a Visual Basic editor or what to do once there. There are a number of ways to handle how a program operates such as a switch in the shortcut or modifying registry entries or sometimes just doing things in an odd sequence or work-around because of how the program is f*ed up. A prime example of this is opening Excel files in seperate windows (of course, that's a seperate window and not a seperate instance.) I understand an earlier version of Word had a setting to deterine whether files were opened in a new process and that feature has been removed somewhere along the way. Sometimes when a feature is removed from the interface it can still be activated with a switch or something else (something that doesn't require programming knowledge.)

I'm sure that being a programmer, you naturally look for a programming solution to higly technical issues. Not being a programmer, I look for other solutions to highly technical issues ... Or I just get a programmer to fix the design. ;-)

Word doesn't always correctly release even the single instance it runs. If closing (X'ing out of the window) additional instances of the program won't, at least most often, release the process then as you say it is not likely to be a good idea to make the attempt in the first place.

I'd rather just use a more stable program like FrameMaker, but I don't have that option here.
 
I understand an earlier version of Word had a setting to deterine whether files were opened in a new process and that feature has been removed somewhere along the way."

Not that I know of.

Firing up Word via Explorer will execute whatever is the pointer to it. It will NOT create and use a different instance.

You could make an actual .EXE that would alwaysd make a new instance, but unless you have someone writing this correctly, this is not going to happen.

Which leaves you with creating a new instance of Word using VBA. Which means you are using an application - for example Word itself - to create a new instance.

In other words, you are in your first instance of Word, and you can use the code I posted to create a new, separate, instance of Word. In THAT one, you can open up another document, and yes, that document will be separate from the first one. Again, this will NOT work using Explorer to open a document.

However...

"You can also open Word and then navigate to the network location of the Sharepoint file using the "open file" dialog, so the procedure would not really be balked by Sharepoint."

In that case, yes, you CAN create and use a separate instance of Word.

Can what you seem to be asking for be done? Yes. However, to be as clean as possible I would:

1. use a specialized global template, rather than normal.dot, for each instance you create.

2. use a specialized exiting procedure to ensure the instance being used - if created via code - is cleanly exited, and all memory allocation for both document and application is properly Set to Nothing.

As you are not familiar with doing this...mmmmm, maybe it is not a good idea.

But just for fun...
Code:
Sub NewOne()
Dim AnotherWord As Word.Application
Set AnotherWord = CreateObject("Word.Application")
AnotherWord.Visible = True
End Sub

Copy the code above, and:

1. IN Word, press Alt-F11 (this gets the VBE)
2. press Ctrl-R (this gets the Project Window)
3. from the toolbar, Insert > Module (this makes a new code module)
4. paste in AnotherOne procedure.
5. put the cursor in the procedure and press F5 (this executes the procedure)

Voila, you now have a separate instance of Word. You can check this by doing a Ctrl-Alt-Del and selecting Processes. You will see two WINWORD.EXE.

You can use the new one to open a document, and yes, that document is running using a totally separate instance of Word.


unknown
 
Fumei,

Thank you!

I tried it and it works, AND I haven't noticed any instability or resource problems.
 
Depending on how you use this, and how many times concurrently...you may!


unknown
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top