Addition/Deletion to autocorrect list by vb

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi all,
using access 2002, i would like to add - on opening a form - an entry to the
list of autocorrections and by closing the form, i would like to delete the
entry. anyone knows, whether this is possible by using vb code in the opening
/ closing procedure?

hopefully thanking in advance

ulrich1947
 
Interesting problem. Access doesn't expose the AutoCorrect object (beyond
the chance to display the dialog box) so a way round is to use Word instead
because AutoCorrect is now shared throughout Office. Here's my code (make
sure M/soft Word Object Library is ticked in Tools, References in Access's VB
Editor):

Private Sub Form_Close()
Dim myWord As New Word.Application
myWord.AutoCorrect.Entries("Mratin").Delete
myWord.Quit
Set myWord = Nothing
End Sub

Private Sub Form_Open(Cancel As Integer)
Dim myWord As New Word.Application
myWord.AutoCorrect.Entries.Add Name:="Mratin", Value:="Martin"
myWord.Quit
Set myWord = Nothing
End Sub

Unfortunately the deletion part doesn't seem to work - I guess some sort of
refresh issue because if you exit Access and then reload it you find the
entry has actually been deleted.

I'd be interested to see a fix for this.
 
Thanks very much, your suggestion mainly helped to solve my problem. I have
put the ADD into the opening procedure of my application and the DELETE into
the closing procedure which is good enough to eliminate my actual problem
(changing the german "ß" into "ss" for sorting and autofill reasons).

However, I tried to act it all through for other needs, as I might need it
occasionally again. It seems to happen the following: Adding / Deleting an
entry by procedure two files in C:\Documents an
Parameters\Administrator\UserData\Microsoft\Office are effected, namely

MSO1031.acl, an AutoCorrect ListFile (containig the list of - german -
autocorrections) and
WORD.pip, an MicroSoft Office Settings File

After adding, MSO1031.acl contains the newly entered autocorrection Text,
the entry ist applicable
After deletion, MSO1031.acl does NOT contain the text regarded anymore
(actually as requested), but the Control within Access, which lists all the
autocorrections, still displays the entries just deleted. Furthermore, the
deleted entry ist still applicable. On the other hand, if one tries to delete
the entry by procedure again, this will lead to the error 5941.

I am not familiar with this kind of programming but obviously the list
displayed consists of a copy of the original file MSO1031.acl which is not
updated simultaneously but gets loaded/connected (probably via WORD.pip) each
time, the application ist started.

Could it be a solution to execute the ".pip" file again while the Access
Application remains open and if, how do I do that. Any idea?

I hope, I made myself clear, although its not my language.

Thanks in advance for trying.

Ulrich 1947
 
Back
Top