Solved

VBScript - Amend Word Autocomplete list

Posted on 2008-10-13
1
702 Views
Last Modified: 2012-06-21
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
Comment
Question by:Barnardos_2LS
1 Comment
 
LVL 1

Accepted Solution

by:
Barnardos_2LS earned 0 total points
ID: 22713030
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to use odbc in vb to connect to ms sql 14 67
Add Attendee Macro need not halt for Acknowledgement 12 32
VB script to continue despite error 2 55
WMIC Output Formatting 1 48
Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
Welcome back!  My apologies for taking so long to write part two of this series; it's been a long time coming!  As I promised in Part 1, this article will focus on how to locate those elusive AD properties that you are searching for.  Why is this us…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question