• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 720
  • Last Modified:

VBScript - Amend Word Autocomplete list

Good afternoon,

How can I amend the Microsoft Word 2003 Autocomplete list using a VBScript? I want to remove an existing entry and replace.

Michael
0
Barnardos_2LS
Asked:
Barnardos_2LS
1 Solution
 
Barnardos_2LSAuthor Commented:
I resolved the issue with the attached code.


'Function to replace a Microsoft Word autotext entry
'Takes the template location, old and new entries as parameters
Function AutoTextReplace(strTemplate, strOldEntry, strNewEntry)
 
Dim i
Set objWord = CreateObject("Word.Application") 
Set objDoc = objWord.Documents.Open(strTemplate, False) 
Set objTxtEntry = objWord.NormalTemplate.AutoTextEntries.Add(strNewEntry, objWord.Selection.Range) 
objWord.NormalTemplate.AutoTextEntries(strNewEntry).Value = strNewEntry 
For Each i In objWord.NormalTemplate.AutoTextEntries 
   If i.Name = strOldEntry Then
	objWord.NormalTemplate.AutoTextEntries(strOldEntry).Delete
   End If
Next 
objWord.Quit 
 
End Function

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now