Computing.Net > Forums > Programming > Script - remap word template source

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Script - remap word template source

Reply to Message Icon

Name: mcr010
Date: December 15, 2005 at 05:03:01 Pacific
OS: XP
CPU/Ram: Lots
Comment:

Hi,

Can anyone halp me with this script?

I need to change the "attached template" path in many files in many directories & concluded that this was the best option. I have however come unstuck with my limited scripting ability!

Here's what I have so far;

Option Explicit
Sub Remap()
Dim strFilePath
Dim strPath
Dim intCounter
Dim strFileName
Dim OldServer
Dim NewServer
Dim nServer
Dim objDoc
Dim objTemplate
Dim dlgTemplate

OldServer = "<\\Server\Templates>"
NewServer = "<K:\Templates>"
nServer = Len(OldServer)
strFilePath = InputBox("What is the folder location that you want to use?")
If Right(strFilePath, 1) <> "\" Then strFilePath = strFilePath & "\"
strFileName = (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 = NewServer & Mid(strPath, (nserver + 1))
End If
strFileName = Dir()
objDoc.Save
objDoc.Close
Loop
Set objDoc = Nothing
Set objTemplate = Nothing
Set dlgTemplate = Nothing

End Sub


Any help most appreciated.



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Script - remap word template source

Word Macro - Field Codes www.computing.net/answers/programming/word-macro-field-codes/15674.html

Lost in the world of Perl script. www.computing.net/answers/programming/lost-in-the-world-of-perl-script/720.html

Opening Word Mail Merge from Access www.computing.net/answers/programming/opening-word-mail-merge-from-access/2345.html