Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-27-2015, 08:09 AM
Lectrician Lectrician is offline Word 2007 - Template is on a missing share Windows 7 64bit Word 2007 - Template is on a missing share Office 2007
Novice
Word 2007 - Template is on a missing share
 
Join Date: Feb 2013
Posts: 19
Lectrician is on a distinguished road
Default Word 2007 - Template is on a missing share

Due to some office moves, and two servers being combined into one, I now have a few hundred documents that are looking for a template file on a share that no longer exists.

For operational reasons, I cannot recreate this share in anyway (the machine name no longer exists locally).

Word 2007 will open the documents, but slowly (pressing esc does work most of the time).



What can I do to correct this to a local version of the template? Is there a way to open every file and correct the path?

This could become rather annoying!

I think I may have asked this before when the share was accessible, but over a slow VPN. Now, the share is NOT available at all.

Thanks.

:-)
Reply With Quote
  #2  
Old 09-27-2015, 12:43 PM
Charles Kenyon Charles Kenyon is offline Word 2007 - Template is on a missing share Windows 8 Word 2007 - Template is on a missing share Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,463
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Once a document is open, link it to the normal template. Make sure that the box to update styles from template is not checked. Save the document.
Reply With Quote
  #3  
Old 09-27-2015, 09:26 PM
Charles Kenyon Charles Kenyon is offline Word 2007 - Template is on a missing share Windows 8 Word 2007 - Template is on a missing share Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,463
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

The following macro should attach the normal template to the current document without updating styles.


Code:
Sub AttachNormalNoStyles()
'
' Attach Normal Template without updating Styles
' written by Charles Kenyon 2015-09-27
' https://www.msofficeforums.com/word/28024-word-2007-template-missing-share.html
'
   With ActiveDocument
                  .UpdateStylesOnOpen = False
                  .AttachedTemplate = Application.NormalTemplate.FullName
   End With
End Sub
For information on what to do with a macro see Installing Macros.
Reply With Quote
  #4  
Old 09-28-2015, 08:08 AM
Lectrician Lectrician is offline Word 2007 - Template is on a missing share Windows 7 64bit Word 2007 - Template is on a missing share Office 2007
Novice
Word 2007 - Template is on a missing share
 
Join Date: Feb 2013
Posts: 19
Lectrician is on a distinguished road
Default

Thanks :-)

Can I adapt that macro to attach the actual template, which is now on a local share?

\\server\share\mytemplate.dot?
Reply With Quote
  #5  
Old 09-28-2015, 10:45 AM
Charles Kenyon Charles Kenyon is offline Word 2007 - Template is on a missing share Windows 8 Word 2007 - Template is on a missing share Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,463
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Yes. You need the full name and filepath inside quotation marks because it is a string.
Reply With Quote
  #6  
Old 09-29-2015, 05:12 AM
Lectrician Lectrician is offline Word 2007 - Template is on a missing share Windows 7 64bit Word 2007 - Template is on a missing share Office 2007
Novice
Word 2007 - Template is on a missing share
 
Join Date: Feb 2013
Posts: 19
Lectrician is on a distinguished road
Default

Code:
Sub AttachNormalNoStyles()
'
' Attach Normal Template without updating Styles
' written by Charles Kenyon 2015-09-27
' https://www.msofficeforums.com/word/28024-word-2007-template-missing-share.html
'
   With ActiveDocument
                  .UpdateStylesOnOpen = False
                  .AttachedTemplate = Application."\\server\share\template.dot"
   End With
End Sub
Sorry - So would this be correct?

Ant I would put this macro into the template itself?
Reply With Quote
  #7  
Old 09-29-2015, 09:12 AM
Charles Kenyon Charles Kenyon is offline Word 2007 - Template is on a missing share Windows 8 Word 2007 - Template is on a missing share Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,463
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Quote:
Originally Posted by Lectrician View Post
Code:
Sub AttachNormalNoStyles()
'
' Attach Normal Template without updating Styles
' written by Charles Kenyon 2015-09-27
' https://www.msofficeforums.com/word/28024-word-2007-template-missing-share.html
'
   With ActiveDocument
                  .UpdateStylesOnOpen = False
                  .AttachedTemplate = Application."\\server\share\template.dot"
   End With
End Sub
Sorry - So would this be correct?

Ant I would put this macro into the template itself?
The expression "Application.NormalTemplate.FullName" returns a string.

Try:
Code:
.AttachedTemplate = "\\server\share\template.dot"
Put it in which template?

I would put it in a Global Template with either a QAT button and/or a keyboard shortcut to trigger it.
Reply With Quote
  #8  
Old 09-29-2015, 01:47 PM
Lectrician Lectrician is offline Word 2007 - Template is on a missing share Windows 7 64bit Word 2007 - Template is on a missing share Office 2007
Novice
Word 2007 - Template is on a missing share
 
Join Date: Feb 2013
Posts: 19
Lectrician is on a distinguished road
Default

Must admit, I am a little confused.

Which template to I add this to?

If I open a saved file which has the rouge missing template attached, this is when I have trouble. Would I need to add this macro to everyone of these files?

I open the files from windows explorer, not through file>open.

Does that make sense?

Thanks.
Reply With Quote
  #9  
Old 09-29-2015, 03:31 PM
Charles Kenyon Charles Kenyon is offline Word 2007 - Template is on a missing share Windows 8 Word 2007 - Template is on a missing share Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,463
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Again, I would put it in a Global Template, not a document template. See link in previous response.

You would run it every time you open a document and have the problem. You will have the problem only once with each document. You could add the line:
activedocument.save
at the end of the macro if you want.

The macro is not added to the document. It is not added to the document's template.
It is in a global template, always available.
You run it when you run into problems and fix the link in the document to the template you want.
Reply With Quote
  #10  
Old 09-30-2015, 09:15 AM
Lectrician Lectrician is offline Word 2007 - Template is on a missing share Windows 7 64bit Word 2007 - Template is on a missing share Office 2007
Novice
Word 2007 - Template is on a missing share
 
Join Date: Feb 2013
Posts: 19
Lectrician is on a distinguished road
Default

Oh, ok. Will give it a go, cheers.

Never used the global template, wasn't sure what you meant, but see, thanks.
Reply With Quote
  #11  
Old 09-30-2015, 10:45 AM
Charles Kenyon Charles Kenyon is offline Word 2007 - Template is on a missing share Windows 8 Word 2007 - Template is on a missing share Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,463
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

See Global Template, Startup Folder
Reply With Quote
  #12  
Old 09-30-2015, 05:36 PM
macropod's Avatar
macropod macropod is offline Word 2007 - Template is on a missing share Windows 7 64bit Word 2007 - Template is on a missing share Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,359
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

When templates other than Word’s Normal template are used to create a document, the template’s path & name are stored with the document. If that path is a network path, a change to the server name will break the link. As you've observed, the result can be significant delays in opening the documents on the new server. See: http://support.microsoft.com/?kbid=830561. The same effect occurs when the file is opened on a computer attached to a different network.

The following macro can be used to update the template paths or, if a new template path can’t be found, to point it to Word’s Normal template. Code is included to restore the original date/time stamps of the updated files.

In the code, simply replace however much of the old & new template paths differ in the OldServer and NewServer variables.
Code:
Option Explicit
Dim FSO As Object 'a FileSystemObject
Dim oFolder As Object 'the folder object
Dim oSubFolder As Object 'the subfolders collection
Dim oFiles As Object 'the files object
Dim i As Long, j As Long
Sub Main()
' Minimise screen flickering
Application.ScreenUpdating = False
Dim StrFolder As String
' Browse for the starting folder
StrFolder = GetTopFolder
If StrFolder = "" Then Exit Sub
i = 0: j = 0
' Search the top-level folder
Call GetFolder(StrFolder & "\")
' Search the subfolders for more files
Call SearchSubFolders(StrFolder)
' Return control of status bar to Word
Application.StatusBar = ""
' Restore screen updating
Application.ScreenUpdating = True
MsgBox i & " of " & j & " files updated.", vbOKOnly
End Sub
Function GetTopFolder() As String
GetTopFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetTopFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function
Sub SearchSubFolders(strStartPath As String)
If FSO Is Nothing Then Set FSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = FSO.GetFolder(strStartPath)
Set oSubFolder = oFolder.subfolders
For Each oFolder In oSubFolder
  Set oFiles = oFolder.Files
  ' Search the current folder
  Call GetFolder(oFolder.Path & "\")
  ' Call ourself to see if there are subfolders below
  Call SearchSubFolders(oFolder.Path)
Next
Set FSO = Nothing
End Sub
Sub GetFolder(StrFolder As String)
Dim strFile As String
strFile = Dir(StrFolder & "*.doc")
' Process the files in the folder
While strFile <> ""
  ' Update the status bar is just to let us know where we are
  Application.StatusBar = StrFolder & strFile
  Call UpdateTemplateRefs(StrFolder & strFile)
  strFile = Dir()
Wend
End Sub
Sub UpdateTemplateRefs(strDoc As String)
' This sub updates the template paths for files after a server
' change. Simply insert however much of the lower end of the
' server paths differ as the OldServer and NewServer variables.
Dim OldServer As String, NewServer As String, strPath As String
Dim oItem As Object, StrDtTm As String
OldServer = "\\TSB\VOL1": NewServer = "\\TSLSERVER\Files"
' Store the file's current Date/Time stamp.
If FSO Is Nothing Then Set FSO = CreateObject("Scripting.FileSystemObject")
Set oItem = FSO.GetFile(strDoc)
StrDtTm = oItem.DateLastModified
' Open the document
Documents.Open strDoc, AddToRecentFiles:=False, ReadOnly:=False, Format:=wdOpenFormatAuto
With ActiveDocument
  If .ProtectionType = wdNoProtection Then
    ' Update the template path
    strPath = Dialogs(wdDialogToolsTemplates).Template
    If LCase(Left(strPath, Len(OldServer))) = LCase(OldServer) Then
      ' Update the file counter for changed files
      i = i + 1
      ' Get the new template path & name
      strPath = NewServer & Mid(strPath, Len(OldServer) + 1)
      ' Check whether the template exists
      If Dir(strPath) <> "" Then
        ' If found, update the path
        .AttachedTemplate = NewServer & Mid(strPath, Len(OldServer) + 1)
      Else
        ' If not found, reset the template to 'Normal'
        .AttachedTemplate = ""
        ' Output an error report in the document from which the macro is run.
        ThisDocument.Range.InsertAfter vbCr & "Template: " & strPath & " not found for " & strDoc
      End If
    End If
  Else
    ' Output a 'protected' file report in the document from which the macro is run.
    ThisDocument.Range.InsertAfter vbCr & strDoc & " protected. Not updated."
  End If
  .Close SaveChanges:=True
End With
' Update the main file counter
j = j + 1
' Let Word do its housekeeping
DoEvents
' Reset the file's Date/Time stamp.
Set oItem = FSO.GetFile(strDoc)
If oItem.DateLastModified <> StrDtTm Then oItem.DateLastModified = StrDtTm
Set oItem = Nothing
End Sub
You can determine how much of the old & new template paths differ, for the purposes of the ‘OldServer, and ‘NewServer’ variables with code like the following, which you can run on a document created on the old server and another created on the new server, both referencing the same template.
Code:
Sub GetTemplateRef()
With ActiveDocument
  MsgBox Dialogs(wdDialogToolsTemplates).Template
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #13  
Old 10-01-2015, 12:29 AM
Lectrician Lectrician is offline Word 2007 - Template is on a missing share Windows 7 64bit Word 2007 - Template is on a missing share Office 2007
Novice
Word 2007 - Template is on a missing share
 
Join Date: Feb 2013
Posts: 19
Lectrician is on a distinguished road
Default

Thanks.

When I run the code to get the path, it just returns "normal" - The other path is not accessible, so I assume by the time word has opened it, it has changed the template?

I thought I knew the old path, and tried using that, but it finishes the routine with "updated 0 of 250 files".

Code:
Sub GetTemplateRef()
With ActiveDocument
  MsgBox Dialogs(wdDialogToolsTemplates).Template
End With
End Sub
Reply With Quote
  #14  
Old 10-01-2015, 01:49 AM
macropod's Avatar
macropod macropod is offline Word 2007 - Template is on a missing share Windows 7 64bit Word 2007 - Template is on a missing share Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,359
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Lectrician View Post
When I run the code to get the path, it just returns "normal" - The other path is not accessible, so I assume by the time word has opened it, it has changed the template?
That suggests whatever you've already done has changed the template used by the document.
Quote:
I thought I knew the old path, and tried using that, but it finishes the routine with "updated 0 of 250 files".
If no files were updated, none currently use the path you provided.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #15  
Old 10-01-2015, 02:47 AM
Lectrician Lectrician is offline Word 2007 - Template is on a missing share Windows 7 64bit Word 2007 - Template is on a missing share Office 2007
Novice
Word 2007 - Template is on a missing share
 
Join Date: Feb 2013
Posts: 19
Lectrician is on a distinguished road
Default

Thanks.

They still take ages to open?

When I ran the small macro to display the existing template, I opened one of the documents. It took ages to load as usual, I assumed it would then change the template to the normal one automatically? Is this not why it displays as normal?
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
New Template window in Word 2007 kerrk Word 1 10-14-2011 02:06 AM
Missing standard office tabs in ribbon for word 2007 pugs Word 5 09-23-2011 12:12 AM
Need help creating a word 2007 resume template gsw1 Word 0 09-27-2010 06:29 PM
How to share macros in Powerpoint 2007?? proshop PowerPoint 0 12-20-2009 07:29 AM
Editing Default Word 2007 Template nhrav Word 0 09-16-2008 05:08 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:10 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft