Word freezes when opening a document based on a non-existent templ

  • Thread starter Chris Wilkinson
  • Start date
C

Chris Wilkinson

hi,

we have a major problem at work. We had a large number of templates that
were scattered across many servers, which we have just consolidated on to 1
server in departmental directories. This works great when creating new
documents based on templates on the new server. The problem is that when we
did the re-organization we switched off the unused servers. Now if you try to
open a document that was created before the change, Word hangs for abour 10
minutes. I assume it is looking for its attached template (on a now
non-existent server). The templates all still exist in the new location (in
various sub directories). Everybody's Workgroup Templates setting is set to
the new location as well.

any help would be appreciated as this causing a major problem,
Chris
 
T

Terry Farrell

The solution is to use the Windows server Redirect command to redirect calls
for the old templates to the new server location. If you need help with
this, ask in an appropriate Windows Server Newsgroup.
 
C

Chris Wilkinson

Hi Terry,

first of all thanks for the quick response. I do have a couple of questions.
The directory structure on the new server is different to the old servers. So
if a template was on \\hgnw06\templates\workgroup, then the new location
would not be \\newserver\templates\workgroup, but more like
\\newserver\templates\dept\workgroup. Would this be a problem?
 
T

Terry Farrell

All I know about this side of network management is that the Redirect
command on the server will see the request for \\hgnw06\templates\workgroup
and redirect it to the new location, \\newserver\templates\dept\workgroup.
But I only know about the Word end of things, not the server side. An
experienced Windows Server administrator should know how to do this.

Terry
 
S

Simon Underwood

If it's the same problem that I'm currently looking at, the problems caused
by opening documents that are performing a lookup or call to a network UNC
path that no longer exists i.e. print information, template location etc. -
as already discussed.

Word 2007 handles it quite well by giving you the option to "Press ESC to
Cancel" when the lookup starts (look at the bottom left status bar) – doc
opens in seconds then. Once open, you then go to "Office Button / Prepare /
Inspect Document" and inspect the document using the "Document Properties and
Personal Information" only selected. This searches the document for hidden
metadata such as printer and template info. Once the scans complete, remove
the info detected and then save the document - opens in seconds rather than
minutes.

Word 2003's a bit different - I haven't worked out a way to bypass the UNC
lookup when the document’s opened (YET) but an "Remove Hidden Data tool for
Office 2003 and Office XP" MS Add-In can be installed to perform the "Inspect
Document Task". You'll have to save the document as a different name, open
and then “save as†again and remove the "Read-Only Recommended" in the
security options but in essence - removes all hidden meta data and allows the
documents to be opened in seconds.

Reference
http://support.microsoft.com/kb/834427

Download
http://www.microsoft.com/downloads/details.aspx?FamilyId=144E54ED-D43E-42CA-BC7B-5446D34E5360

All praise to Word 2007 - liking it more and more as time goes by!!!

I'll post a fix to bypass the UNC lookup in Word 2003 if I find it!!!

Hope this helps!
 
C

Chris

The attached script will traverse a tree of folders searching for *.doc and
upon discovery will open each and reset the attached template to
"normal.dot". Cut the code out and paste it into "traverse.js" and copy this
file to the root directory where you want to fix all the documents. It will
leave "traverse.log" in the "current" directory. Investigation of my log
file showed that I was spending almost five minutes waiting for the timeout.

I believe that you must run it on a machine which has Word installed. Three
are three sections commented out which you can deply and they will tell a
small amount about the progress but these are not as good as the log file, so
I recommend that you leave them as they are.

There is nothing delicate about this script, but it works well. I fixed
25,000 documents...







//
// Traverse a document tree and execute for each "*.doc" discovered
//

function main()
{
var d;

if (WScript.Arguments.count()>0)
{
d = WScript.Arguments.Item(0);
}
else
{
var fs = new ActiveXObject("Scripting.FileSystemObject");
d = fs.GetFolder(".");
}
traverse(d);
}



function traverse(d)
{
var w = new ActiveXObject("Word.Application");

var cmd = new ActiveXObject("WScript.shell");

// if (cmd.Popup(d, 1, "Directory", 64 + 1) == 2)
// {
// var log = fs.OpenTextFile("traverse.log", 8, true);
// log.WriteLine("Quit:[" + ts() + "] " + s);
// log.Close();
//
// w.Quit(0);
// w = null;
// WScript.Quit();
// }

var fs = new ActiveXObject("Scripting.FileSystemObject");
var f = new Enumerator(fs.GetFolder(d).files);

for ( ; !f.atEnd(); f.moveNext())
{
var e = f.item().Name.split(".");
if (e[e.length-1].toUpperCase() != "DOC"){continue;}

// if (cmd.Popup(f.item().Name, 1, "Document Found", 64 + 1) == 2)
// {
// var log = fs.OpenTextFile("traverse.log", 8, true);
// log.WriteLine("Quit:[" + ts() + "] " + s);
// log.Close();
//
// w.Quit(0);
// w = null;
// WScript.Quit();
// }

//
// I have a document ... Repair the attached template
//
var s = f.item().ParentFolder + "\\" + f.item().Name;

var log = fs.OpenTextFile("traverse.log", 8, true);
log.WriteLine("Open:[" + ts() + "] " + s);
log.Close();

var doc = w.Documents.Open(s);

// if (cmd.Popup(f.item().Name, 1, "Document Opened", 64 + 1) == 2)
// {
// var log = fs.OpenTextFile("traverse.log", 8, true);
// log.WriteLine("Quit:[" + ts() + "] " + s);
// log.Close();
//
// w.Quit(0);
// w = null;
// WScript.Quit();
// }

doc.AttachedTemplate = "normal.dot";
w.Dialogs(87).Execute();
doc.Save();
doc.Close();

var log = fs.OpenTextFile("traverse.log", 8, true);
log.WriteLine("Done:[" + ts() + "] " + s);
log.Close();
}
w.Quit(0);
w = null;

var f = new Enumerator(fs.GetFolder(d).SubFolders);
for ( ; !f.atEnd(); f.moveNext())
{
traverse(f.item().ParentFolder + "\\" + f.item().Name);
}
}

function ts()
{
var t = new Date();
var hr = "0" + t.getHours(); hr = hr.substr(hr.length-2, 2);
var mn = "0" + t.getMinutes(); mn = mn.substr(mn.length-2, 2);
var sc = "0" + t.getSeconds(); sc = sc.substr(sc.length-2, 2);
return(hr + ":" + mn + ":" + sc);
}

main();
 
T

Terry Farrell

Thanks, I will keep this for future help to other users. We appreciate your
help.

Terry

Chris said:
The attached script will traverse a tree of folders searching for *.doc
and
upon discovery will open each and reset the attached template to
"normal.dot". Cut the code out and paste it into "traverse.js" and copy
this
file to the root directory where you want to fix all the documents. It
will
leave "traverse.log" in the "current" directory. Investigation of my log
file showed that I was spending almost five minutes waiting for the
timeout.

I believe that you must run it on a machine which has Word installed.
Three
are three sections commented out which you can deply and they will tell a
small amount about the progress but these are not as good as the log file,
so
I recommend that you leave them as they are.

There is nothing delicate about this script, but it works well. I fixed
25,000 documents...







//
// Traverse a document tree and execute for each "*.doc" discovered
//

function main()
{
var d;

if (WScript.Arguments.count()>0)
{
d = WScript.Arguments.Item(0);
}
else
{
var fs = new ActiveXObject("Scripting.FileSystemObject");
d = fs.GetFolder(".");
}
traverse(d);
}



function traverse(d)
{
var w = new ActiveXObject("Word.Application");

var cmd = new ActiveXObject("WScript.shell");

// if (cmd.Popup(d, 1, "Directory", 64 + 1) == 2)
// {
// var log = fs.OpenTextFile("traverse.log", 8, true);
// log.WriteLine("Quit:[" + ts() + "] " + s);
// log.Close();
//
// w.Quit(0);
// w = null;
// WScript.Quit();
// }

var fs = new ActiveXObject("Scripting.FileSystemObject");
var f = new Enumerator(fs.GetFolder(d).files);

for ( ; !f.atEnd(); f.moveNext())
{
var e = f.item().Name.split(".");
if (e[e.length-1].toUpperCase() != "DOC"){continue;}

// if (cmd.Popup(f.item().Name, 1, "Document Found", 64 + 1) == 2)
// {
// var log = fs.OpenTextFile("traverse.log", 8, true);
// log.WriteLine("Quit:[" + ts() + "] " + s);
// log.Close();
//
// w.Quit(0);
// w = null;
// WScript.Quit();
// }

//
// I have a document ... Repair the attached template
//
var s = f.item().ParentFolder + "\\" + f.item().Name;

var log = fs.OpenTextFile("traverse.log", 8, true);
log.WriteLine("Open:[" + ts() + "] " + s);
log.Close();

var doc = w.Documents.Open(s);

// if (cmd.Popup(f.item().Name, 1, "Document Opened", 64 + 1) == 2)
// {
// var log = fs.OpenTextFile("traverse.log", 8, true);
// log.WriteLine("Quit:[" + ts() + "] " + s);
// log.Close();
//
// w.Quit(0);
// w = null;
// WScript.Quit();
// }

doc.AttachedTemplate = "normal.dot";
w.Dialogs(87).Execute();
doc.Save();
doc.Close();

var log = fs.OpenTextFile("traverse.log", 8, true);
log.WriteLine("Done:[" + ts() + "] " + s);
log.Close();
}
w.Quit(0);
w = null;

var f = new Enumerator(fs.GetFolder(d).SubFolders);
for ( ; !f.atEnd(); f.moveNext())
{
traverse(f.item().ParentFolder + "\\" + f.item().Name);
}
}

function ts()
{
var t = new Date();
var hr = "0" + t.getHours(); hr = hr.substr(hr.length-2, 2);
var mn = "0" + t.getMinutes(); mn = mn.substr(mn.length-2, 2);
var sc = "0" + t.getSeconds(); sc = sc.substr(sc.length-2, 2);
return(hr + ":" + mn + ":" + sc);
}

main();
 
R

Robin Collins

Can someone please inform me what I save this script as ? For example is it VBScript.vb ?
hi,

we have a major problem at work. We had a large number of templates that
were scattered across many servers, which we have just consolidated on to 1
server in departmental directories. This works great when creating new
documents based on templates on the new server. The problem is that when we
did the re-organization we switched off the unused servers. Now if you try to
open a document that was created before the change, Word hangs for abour 10
minutes. I assume it is looking for its attached template (on a now
non-existent server). The templates all still exist in the new location (in
various sub directories). Everybody's Workgroup Templates setting is set to
the new location as well.

any help would be appreciated as this causing a major problem,
Chris
On Thursday, May 01, 2008 9:17 AM Terry Farrell wrote:
The solution is to use the Windows server Redirect command to redirect calls
for the old templates to the new server location. If you need help with
this, ask in an appropriate Windows Server Newsgroup.
On Thursday, June 19, 2008 6:20 PM Chri wrote:
The attached script will traverse a tree of folders searching for *.doc and
upon discovery will open each and reset the attached template to
"normal.dot". Cut the code out and paste it into "traverse.js" and copy this
file to the root directory where you want to fix all the documents. It will
leave "traverse.log" in the "current" directory. Investigation of my log
file showed that I was spending almost five minutes waiting for the timeout.

I believe that you must run it on a machine which has Word installed. Three
are three sections commented out which you can deply and they will tell a
small amount about the progress but these are not as good as the log file, so
I recommend that you leave them as they are.

There is nothing delicate about this script, but it works well. I fixed
25,000 documents...







//
// Traverse a document tree and execute for each "*.doc" discovered
//

function main()
{
var d;

if (WScript.Arguments.count()>0)
{
d = WScript.Arguments.Item(0);
}
else
{
var fs = new ActiveXObject("Scripting.FileSystemObject");
d = fs.GetFolder(".");
}
traverse(d);
}



function traverse(d)
{
var w = new ActiveXObject("Word.Application");

var cmd = new ActiveXObject("WScript.shell");

// if (cmd.Popup(d, 1, "Directory", 64 + 1) == 2)
// {
// var log = fs.OpenTextFile("traverse.log", 8, true);
// log.WriteLine("Quit:[" + ts() + "] " + s);
// log.Close();
//
// w.Quit(0);
// w = null;
// WScript.Quit();
// }

var fs = new ActiveXObject("Scripting.FileSystemObject");
var f = new Enumerator(fs.GetFolder(d).files);

for ( ; !f.atEnd(); f.moveNext())
{
var e = f.item().Name.split(".");
if (e[e.length-1].toUpperCase() != "DOC"){continue;}

// if (cmd.Popup(f.item().Name, 1, "Document Found", 64 + 1) == 2)
// {
// var log = fs.OpenTextFile("traverse.log", 8, true);
// log.WriteLine("Quit:[" + ts() + "] " + s);
// log.Close();
//
// w.Quit(0);
// w = null;
// WScript.Quit();
// }

//
// I have a document ... Repair the attached template
//
var s = f.item().ParentFolder + "\\" + f.item().Name;

var log = fs.OpenTextFile("traverse.log", 8, true);
log.WriteLine("Open:[" + ts() + "] " + s);
log.Close();

var doc = w.Documents.Open(s);

// if (cmd.Popup(f.item().Name, 1, "Document Opened", 64 + 1) == 2)
// {
// var log = fs.OpenTextFile("traverse.log", 8, true);
// log.WriteLine("Quit:[" + ts() + "] " + s);
// log.Close();
//
// w.Quit(0);
// w = null;
// WScript.Quit();
// }

doc.AttachedTemplate = "normal.dot";
w.Dialogs(87).Execute();
doc.Save();
doc.Close();

var log = fs.OpenTextFile("traverse.log", 8, true);
log.WriteLine("Done:[" + ts() + "] " + s);
log.Close();
}
w.Quit(0);
w = null;

var f = new Enumerator(fs.GetFolder(d).SubFolders);
for ( ; !f.atEnd(); f.moveNext())
{
traverse(f.item().ParentFolder + "\\" + f.item().Name);
}
}

function ts()
{
var t = new Date();
var hr = "0" + t.getHours(); hr = hr.substr(hr.length-2, 2);
var mn = "0" + t.getMinutes(); mn = mn.substr(mn.length-2, 2);
var sc = "0" + t.getSeconds(); sc = sc.substr(sc.length-2, 2);
return(hr + ":" + mn + ":" + sc);
}

main();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top