opening word documents from network share takes ages. RRS feed

  • Question

  • hi, after moving all our data to new server, all our word documents are taking forever to open. it tuned out to be template path of all those documents is referring to our old server which doesn't exist anymore. is there way to change template for all the docs at once. we have several thousands of word docs, so it's not ideal to go one by one. i have tried below script, it is working but only for that folder. i want this script to make changes for docs in sub folders as well. any help would be appreciated. thanks in advance.

    Sub Test()

    Dim strFilePath As String

    Dim strPath As String

    Dim intCounter As Integer

    Dim strFileName As String

    Dim OldServer As String

    Dim objDoc As Document

    Dim objTemplate As Template

    Dim dlgTemplate As Dialog

    Dim nServer As Integer

    'hardcode the name of the old server.

    OldServer = "{enter the name of the Old Server}"

    nServer = Len(OldServer)

    strFilePath = InputBox("What is the folder location that you want to use?")

    If Right(strFilePath, 1) <> "\" Then strFilePath = strFilePath & "\"

    strFileName = Dir(strFilePath & "*.doc")

    Do While strFileName <> ""

    Set objDoc = Documents.Open(strFilePath & strFileName)

    Set objTemplate = objDoc.AttachedTemplate

    Set dlgTemplate = Dialogs(wdDialogToolsTemplates)

    strPath = dlgTemplate.Template

    If LCase(Left(strPath, nServer)) = LCase(OldServer) Then

    objDoc.AttachedTemplate = NormalTemplate

    End If

    strFileName = Dir()




    Set objDoc = Nothing

    Set objTemplate = Nothing

    Set dlgTemplate = Nothing

    End Sub


    Saturday, June 9, 2012 8:28 PM


  • hi guys, if anyone is having same issue, here is the solution. cheers


    • Marked as answer by Max Meng Tuesday, June 12, 2012 5:41 AM
    Monday, June 11, 2012 4:25 PM

All replies