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

Word fails to Start, Indicates file corrupt

Status
Not open for further replies.

rmcar

Technical User
Oct 9, 2003
15
US
We are having an issue with Word 2003, A legacy file server was the default location for word templates. Group policy has been used to point to the new server for the default locations. Trouble is that whenever the legacy server is shutdown and a user tries to open an older word document the application just hangs. When Word is restarted the message comes up indicating the file is corrupt and has been disabled. If we trun the legacy server back on this problem goes away. Any ideas? Group Policy legacy issues? I've done a regedit to delete the references to the old server in the registry to no avail.
Thanks!
 
Bummer. Yeah, this issue has been posted before. The older files should have had the attached template property changed. Darned if I can find the thread that I posted some code to do that, but it is here somewhere....

The references are not in the registry, they are in the files themselves, the ActiveDocument.AttachedTemplate property. Essentially you need to run through the files, reattaching the templates using the new path.

I will try and find that thread. It is not all that big a deal to do this.

Gerry
 
Thanks! We essentially came to the same conclusion. Any scripting ideas/pointers would be greatly appreciated.
 
Still can't find the thread, but essentially, it will be something like the following. Unfortunately, you can not use the AttachedTemplate property without opening the file. How many files / how many folders? The following uses only one path to a folder. You would need to adjust accordingly. And of course you have to use your own folder path....
Code:
Dim myDocPath As String
Dim myTemplateLocation As String
Dim oFile
myPath = "C:\temp\"
myTemplateLocation = [i]new FULL Path and Name![/i]
oFile = Dir(myDocPath & "*.doc")
Do While oFile <> ""
  Documents.Open Filename:= myPath & oFile
  With ActiveDocument
    .AttachedTemplate = myTemplateLocation
    .Save
    .Close
  End With
  oFile = Dir
Loop
Obviously this would need to be adjusted for multiple folders. Anyways, it will look something like the above. You could also use FileSystemObject to process. The code for that would be a bit different.


Gerry
 
Thanks again! Unfortunately for us there are multiple forms and folders. This is a place to start.
 
What do you mean by multiple "forms"? Multiple folders can be worked into the code, but I am not sure what forms you are talking about.

Gerry
 
DO the 'old' templates still exist and have they been moved to a new location on the new server? If so, I would have thought that you could use a redirect to point to the new location.

Alternatively, if you open the documents (with the legacy server on), you can go to Tool, Templates and add-ins and attach the template (in its new location) to the document which will stop it looking for the old server. This is only any good if the number of documents isn't too great!


Regards: tf1
 
Hi tf. What sort of redirect are you thinking about? Yes, it should work, but it depends of course on the templates being in the defined File Locations. If they were not, then it would not help.

And of course using Tools > Templates to attach is simply the manual way of using the .AttachedTemplate property. As you point out, this is not very effective if there a lot of files.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top