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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Word or MS Weird? Forgets app is already running?

Status
Not open for further replies.

MakeItSo

Programmer
Oct 21, 2003
3,316
DE
Hi friends,

MS Word never ceases to amaze me.
I have Word running, open files, execute a few macros - and then, when I double click a Word doc to open it, it does - but in a new Word instance, in which my macro templates are not loaded!
[3eyes]

Additionally, sometimes one of my macros will not function anymore. It uses a placeholder search and will fire an "invalid group number" error. Closing Word and restarting it will fix this "error".
[flush2]

Why does word behave in this peculiar way?

Affected version: Word 2003 with installed Office compatibility pack, running on XP Pro SP3.

Thanks for any hint!

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
Can you try it without the Office compatibility pack to see if possibly it has something to do with that?

Also, do you have access to a copy of 2007 to see if that would fix the issue? If it's caused by something with the compatibility pack, then going to 2007 would fix being able to open 2007 docs, and eliminate the problem at the same time - IF it is with that pack... But it's just a wild guess at this point. [smile]

--

"If to err is human, then I must be some kind of human!" -Me
 
Going to 2007?
Only under threat of violence!
[tongue]

I might give it a try uninstalling the compatibility pack later, although it would surprise me if that were the cause.
It's actually nothing but an extension to the file filter.

Thanks!

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
I just figured since the problem doesn't seem to make sense, then a nonsensical solution might just be the answer. [wink]

Well, hopefully someone will actually have some experience with the issue and can say for sure what the issue is. [smile]

--

"If to err is human, then I must be some kind of human!" -Me
 
MakeItSo, have you solved this? It is hard to suggest something without knowing what your code is doing.

I am particularly interested in: "in which my macro templates are not loaded!"

Where do have these macros?

Gerry
 
Gerry,

I have these macros stored in several templates. One DOT contains a set of macros specific to this work, another DOT those specific to that work and so forth.

This error usually occurs in connection with one template containing a split/join macro when I try to split a document. This document was created in the earlier stage of the project simply by joining a bunch of files with the same template.

This is what the template chiefly does:
Code:
For i = 1 To Application.FileSearch.FoundFiles.Count
        With doc.Content
            .InsertAfter "{%file: " & Application.FileSearch.FoundFiles(i) & "%}" & vbNewLine
            .Collapse wdCollapseEnd
            .InsertFile Application.FileSearch.FoundFiles(i)
        End With
        With doc.Content
            .InsertAfter "{%fileend%}" & vbNewLine
            .Collapse wdCollapseEnd
        End With
    Next i
I have to process and forward dozens, sometimes hundreds of miniature files, often containing hardly more than one sentence. So with this macro, I create one large document with all miniature files embedded and enclosed by information of the file's fully qualified name & location.
Mind you: "{%file..." might look like RTF but it is actually visible text within that document.

After the document has been processed, I need to split it back into its original files.
The split macro then does nothing more than perform a search for the file-delimiting {%file...} ... {%fileend%},
cut the file, paste it into a new document and save that using the file information extracted from the delimiters.

So far so good, both splitting and joining function well.
However, sometimes, after I have just split a document, I and need to split yet another, I double click said file to open it - and voilà: it does open, but in a new Word instance. As my macro templates are not stored in the startup folder (don't wish to clog up my Word with all my macros), this new instance is back to state "clean", i.e. with my macro templates not loaded.

THAT is what I don't get. Sometimes also, the doc will open in my existing instance of Word with my split macro loaded, but my split macro will then on execution fire an "invalid group number" error. I close Word, re-start it, and the error is gone!

Sometimes I can spli docs and do other macroed processing on a dozen files without problem; sometimes it'll fire the error on the third try already, especially when I handle Asian files.
Could this be some memory overflow or anything?
Does the Word process handler get mixed up?
I just don't get it.
[3eyes]

P.S: Talking about German Word 2003 SP3 running on German XP Pro SP3.


[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
Just to be clear...

SOME times, if you double click a file it does load into the current instance, and SOME times it makes a new "clean" instance. Correct?

BTW: the "proper" and "normal" behaviour for Word is indeed to open a new instance.

Gerry
 
Hi Gerry,

yes, that is exactly what happens.
BTW: the "proper" and "normal" behaviour for Word is indeed to open a new instance.
Is it? Then why doesn't it behave "properly" and "normally" most of the time?
And more important: can I determine Word to always use an existing instance if applicable?

Thanks a lot!
Andy

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
BTW: the "proper" and "normal" behaviour for Word is indeed to open a new instance.

I got curious on this one. I realize that each document opens in a separate window, but I thought it was all the same instance. So I looked it up:
Apparently, Microsoft agrees - it's one instance, just separate Windows. That is unless it's changed in Word 2003 or Word 2007. It just LOOKS like it's separate instances b/c of the SDI (Single Document Interface) design.

And I was about to say I hadn't tested it, but I figured - WHY NOT?! So I created a new document, then opened 2 existing documents... (I'm using Office 2007)

Task Manager shows 3 open documents under "Applications", but under "Processes", there is only one WINWORD.EXE...

However, if I open MS Word directly from the Program shortcut, rather than a document... still just one process... so now I'm wondering if it's possible, and if so, how do you open a separate instance of Word? With Excel, you can easily open one instance with multiple documents or several instances with one or more documents per instance.

Well, that's not important for me, for now, but I am curious... anybody got any ideas on that one? Or am I veeering too far off topic at this point? [ponder]

--

"If to err is human, then I must be some kind of human!" -Me
 
I think a new thread on 'instances' would be a good idea. I'll start one.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
I realize that each document opens in a separate window, but I thought it was all the same instance. So I looked it up:
Apparently, Microsoft agrees - it's one instance, just separate Windows. That is unless it's changed in Word 2003 or Word 2007. It just LOOKS like it's separate instances b/c of the SDI (Single Document Interface) design.

In this (my) case, the matter is different.
One instance with multiple Windows is what I consider "normal" Word behaviour, and there is no problem with that.

Say, you have a custom macro template, which you do not store in Word's "Startup" folder, but in a different one, say "D:\Macros_and_Templates\".

Then you can add it to your "Add-Ins and Templates". It will be unloaded by default, so that when you start Word and wish to use your macros, you need to click Tools->Add-Ins and templates and there select the check box next to your template.

So this is what I do: I start word, activate my macro template by ticking the check box in "Templates & Add-ins", and start opening the first file and processing it.
After completion, I open the next file, and so forth. These usually open in the existing instance, which can be easily verfied by looking at the menu bar: my custom macro menu is visible there; all fine.

Sometimes, only sometimes though, after I have processed a few files, and open the next file to be processed by double clicking it in Windows Explorer, the document will not open in the existing Word instance but in a new one.
This is very easily verifiable by
a) seeing that the macro template is not activated in this new instance and my menu bar not present
b) seeing another Winword.exe process in Task manager

[ponder]

It's weird...

Perhaps if I somehow free the stack resp. macro memory or whatever it is, that would solve the problem. :-?

Dunno...

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
I suppose that Word operates somewhat like Excel then, when you're using Add-ins and templates. I've not needed them at least in a while with Word in my current role, so I can't say from experience.

But if it is that way, perhaps the only or easiest way to get around it is to open it with File/Office Button, Open; rather than double-clicking from Windows Explorer?

--

"If to err is human, then I must be some kind of human!" -Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top