Link to home
Start Free TrialLog in
Avatar of NetAdmin2436
NetAdmin2436Flag for United States of America

asked on

Slow Microsoft Word Files....looking for old template

Hey Gang-
Recently I moved one of my 'Sales' shares to a new server. Now, some of the .doc (word) documents open up very very slow, 30 seconds or so. However, Some word documents are OK and open normal. With Word 2007,  i see a "contacting \\OLDSERVER\Sales\Quote Template... for information. Press ESC to cancel." is displayed down at the bottom left corner of word. if I hit <esc> the file will come up very soon after. Ok, great...but that's just silly for hundreds, if not thousands of word files. I can say that all (if not most) these files were made from a word template.

I understand it is looking for *something* on the word  template on the OLDSERVER. I just shut down the OLDSERVER yesterday. I realize I could just turn on the OLDSERVER and everything would be hunky dory again, but I'm trying to get rid of the server, not keep it around.

So, i guess my question is what e-x-a-c-t-l-y is it looking for and how can i fix this? I have hundreds, if not more of these doing it. So going through each word document would be a major pain.....


Thanks in Advance
NetAdmin2436
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

The usual way to fix the problem is to have the old and the new server available. Open each affected document, attach the new template and save the document.
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NetAdmin2436

ASKER

Darn....
I changed the FindFiles "C:\...." and ActiveDocument.AttachedTemplate lines to match my old server and new server and shares. I ran the script from my server with the new share but I get this:

Line: 6
Char: 15
Error: Expected '('
Code: 800A03ED
Source: Microsoft VBScript compilation error.


So with a .dot template... You make changes to the template.dot and 'save as', then save new file as 'microsoft.doc'. Now microsoft.doc has all the neccessary data, but still looks to the 'template.dot' file for any changes? So that if you needed to change some wording in the template you can change the template and then all the .doc files will update automatically when they are opened? Am I correct in this thinking? I never really knew how exactly the .dot templates worked....


Thanks you for your help so far...
Well I wrote it as Word VBA macro, have you tried it as such?

"So with a .dot template... You make changes to the template.dot and 'save as', then save new file as 'microsoft.doc'. Now microsoft.doc has all the neccessary data, but still looks to the 'template.dot' file for any changes? So that if you needed to change some wording in the template you can change the template and then all the .doc files will update automatically when they are opened? Am I correct in this thinking? I never really knew how exactly the .dot templates worked...."


Yes, you can make changes to a template file and save it as another name.

Documents that are created from it can be linked to the new version by changing its AttachedTemplate to the new one.

However, I don't think you have the right idea about changing the wording. The text in the document part of a template is copied to the new document when the latter is created. It is the starting text for your document. Thereafter the text is not used. It is other template objects such as macros and autotext that are available to the document for later use.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ctharp
ctharp

Sorry, didn't realize it was file dependant. If you notice performance issues when opening office I would look into my above suggestion. You would be surprised how many broken links to the old server there is.
Initially I tried it as a VBS...Opps

I tried to run it as a Word VBA Macro from the NewServer. The script seemed to open all the word file and close them quickly and onto the next. After about 50 mins the script finished, but the files have the same behavior. The old template name is still there.  

I've Manually removed the template reference from a few .doc's and then they open normal.

Instead of trying to point them toward the new template, could we just have it delete any reference to any templates?
Sweet!

With some help from my software engineer, I was able to get it to run with a minor modification. Took a few hours for the script to complete. However, that saved me LOTS of time, phone calls and headaches.

Thank you SO much GrahamSkan!!!
What was the modification?
OK, I've had a few people email about the modification....so here we go. It was a while ago, but I *think* this is what we did. Bear with me. Open word, save the following as a macro with the created button. I am by no means a programmer and truthfully don't understand much of this. Change the \\NewServer\ to your server and change any other paths to meet your needs. Save or run this macro on the new server. If it works right, it should take a while to complete. If you have hundreds or thousands, it may take hours to complete.




Sub FindFiles(strFolder As String, strFilePattern As String)
    Dim strFileName As String
    Dim strFolders() As String
    Dim iFolderCount As Integer
    Dim i As Integer
   
    'collect child folders
    strFileName = Dir$(strFolder & "\", vbDirectory)
    Do Until strFileName = ""
        If (GetAttr(strFolder & "\" & strFileName) And vbDirectory) = vbDirectory Then
            If Left$(strFileName, 1) <> "." Then
                ReDim Preserve strFolders(iFolderCount)
                strFolders(iFolderCount) = strFolder & "\" & strFileName
                iFolderCount = iFolderCount + 1
            End If
        End If
        strFileName = Dir$()
    Loop
   
    'process files in current folder
    strFileName = Dir$(strFolder & "\" & strFilePattern)
    Do Until strFileName = ""
            DoEvents
            Documents.Open strFolder & "\" & strFileName
            If ActiveDocument.AttachedTemplate.Name <> "Normal.Dot" Then
                ActiveDocument.AttachedTemplate = "\\NewServer\Company\Sales\Quote Templates\" & ActiveDocument.AttachedTemplate.Name
                ActiveDocument.Close wdSaveChanges
            Else
                ActiveDocument.Close wdDoNotSaveChanges
            End If
        strFileName = Dir$()
    Loop
   
    'look through child folders
    For i = 0 To iFolderCount - 1
        FindFiles strFolders(i), strFilePattern
    Next i
   
   
End Sub

Private Sub CommandButton1_Click()
    MsgBox ("Start")
    FindFiles "C:\Company\Sales\Master Quote File", "*.doc"
    MsgBox ("Completed")
End Sub
....Or it was this. LOL. I honestly can't remember, but these are the two scripts I saved, so one of them worked.






Sub ChangeTemplates()

End Sub

Sub FindFiles(strFolder As String, strFilePattern As String)
    Dim strFileName As String
    Dim strFolders() As String
    Dim iFolderCount As Integer
    Dim i As Integer
   
    'collect child folders
    strFileName = Dir$(strFolder & "\", vbDirectory)
    Do Until strFileName = ""
        If (GetAttr(strFolder & "\" & strFileName) And vbDirectory) = vbDirectory Then
            If Left$(strFileName, 1) <> "." Then
                ReDim Preserve strFolders(iFolderCount)
                strFolders(iFolderCount) = strFolder & "\" & strFileName
                iFolderCount = iFolderCount + 1
            End If
        End If
        strFileName = Dir$()
    Loop
   
    'process files in current folder
    strFileName = Dir$(strFolder & "\" & strFilePattern)
    Do Until strFileName = ""
            DoEvents
            Documents.Open strFolder & "\" & strFileName
            If ActiveDocument.AttachedTemplate.Path = "\\OldServer\Sales\Quote Templates\" Then
                ActiveDocument.AttachedTemplate = "Normal"
                ActiveDocument.Close wdSaveChanges
            Else
                ActiveDocument.Close wdDoNotSaveChanges
            End If
        strFileName = Dir$()
    Loop
   
    'look through child folders
    For i = 0 To iFolderCount - 1
        FindFiles strFolders(i), strFilePattern
    Next i
   
   
End Sub

Private Sub CommandButton1_Click()
    MsgBox ("Start")
    FindFiles "C:\Company\Sales\Master Quote File", "*.doc"
    MsgBox ("Completed")
End Sub

Private Sub Document_New()

End Sub
has anyone tried this? which Macro works?
And does this macro work with Word 2007.  I get an error on Dir$
Any confirmation that this worked?
I found the same issues described above when I moved data from a windows shared folder on a small network to Ubuntu running samba.
my problem is I can't is the macro on the Linux box sharing the files.

Funny thing is, if I change the mapped drive from the netbios name eg: \\Server\user\docs
to \\192.168.0.100\user\docs it works fine without the searching for template location first.

I am using Dropbox for some staff wanting to work from home and it is showing the same stall in searching the old network location at a different location off site.
IN office 2007 the esc keys gets them in fast. BUT office 2010 give no esc option and makes you sit and watch the thing search the old network share address.
Being the boss using this method of file sync I need to find a solution to the problem as if the IP address share did not work.

This is not on all documents, just files that were opened via a template of some kind. I can see the location folder the template is searching for. How do I open the file and attach the new template folder location and save it again from the created file. This was Graham’s first reply. Can I have some more instructions here regarding doing this step by step?

There is not that many files but they are scattered through the file server. So when staff find them and call me I will need to give help desk support to resolve this problem manually.

Any help appreciated.

Josh. :-)