HTFC Forums

H.T.F.C.

How To Fix Computers





Go Back   HTFC Forums > Software Newsgroups > Microsoft Office

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1  
Old 03-28-2008, 04:08 PM
Malcz86
 
Posts: n/a
Default Changing multiple word document templates

I have several thousand word documents that need template paths changing I've
done a bit of googling and found the below script,

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()

objDoc.Save

objDoc.Close

Loop

Set objDoc = Nothing

Set objTemplate = Nothing

Set dlgTemplate = Nothing

End Sub

Problem is it doesn't work????

I assume I'm meant to put something in here,

OldServer = "{enter the name of the Old Server}"
nServer = Len(OldServer)

But what????
Reply With Quote
Sponsored Links
Fix your Windows Problems - FAST.
FREE Safe Scan Registry Check. Locate & Fix Errors in Minutes!
Reply


Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Include Customer Templates in Office Document Edoardo Microsoft Office 1 01-26-2008 03:50 PM
Templates in Word 2003 don't work in Word 2007 jerosejr Microsoft Office 1 01-25-2008 04:55 PM
Whats the best way to provide document templates to 75 users? Law Microsoft Office 1 01-07-2008 04:40 PM
accidentally moved a MS Word document,now it dissapears everytime i open any word document tim Windows Vista 2 09-14-2007 06:44 PM
Changing templates in Office 2007 jchchye Microsoft Office 1 06-29-2007 04:22 PM


All times are GMT. The time now is 06:37 AM.


Powered by vBulletin® Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© 2004 - 2007 Web-S-Sense Pty. Ltd. Usenet and forums posts © their respective authors.
Ad Management by RedTyger