Solved

Need VBA solution for autotext replacement like Phrase Express or Robotype

Posted on 2014-01-05
6
816 Views
Last Modified: 2014-01-07
I want a custom text expansion/autotext function for my Microsoft Office applications. I can't load outside programs such as PC Magazines Robotype, to my work computer because of IT policy. However, I do have VBA available.

I'd like to develop an autotext function with vba.  I know about the Word function for this task but I don't like how it's implemented.  I'd like a separate database for custom text expansion or boilerplate text expansion rather than having my custom stuff mixed in with the Word stuff.

I was thinking about an array of my custom abbreviations with replacements.  Better yet, the array would read from an Access table.

The trigger would be that when the spacebar is pressed after a defined autotext element/record, the replacement text would be typed immediately rather than completing a document and doing a find/replace.  This is how RoboType works.

I am willing to learn some VBA to do this, I need to know some general concepts as to how to get this done and then figure out the details as I go.
0
Comment
Question by:rreiss60
6 Comments
 
LVL 21

Accepted Solution

by:
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 260 total points
ID: 39757510
I have done the same thing using this VBA code:

MS Access™ 97 / 2000 / 2007 Spell Checker / Dictionary Tool with Source Code

http://www.pcesoft.com/Access-Spell-Checker-Tool-Source-Code.html
You can download the source code for our MS Access™ Spell Checker for either the MS Access 97™, MS Access 2000™ or MS Access 2007™ versions for FREE. If you find the code useful, please use the Donate button below. Our Spell-Checker solves the problem of how to distribute the Spell-Checker ability in your applications (Access does not include a spell checker which runs in runtime mode. Our spell checker DOES run in runtime mode, giving your users a useful spell checker in your Access runtime distribution!). We offer a complete Access 97, Access 2000 or Access 2007 spell check solution, with source code!

The Access Team Blog also mentioned it here: http://blogs.office.com/b/microsoft-access/archive/2008/09/04/open-source-spell-check-for-the-runtime.aspx
0
 
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 100 total points
ID: 39758013
There is an AutoCorrect option in all Office applications that can do that.

It's in the Tools menu. Any changes you make to the list of AutoCorrect options is saved in a .acl file that is kept in the following directory on my Windows8 computer (probably at the same place since Vista): C:\Users\<username>\AppData\Roaming\Microsoft\Office.

This file can be distributed between computers and users.
0
 
LVL 84

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 40 total points
ID: 39758016
for my Microsoft Office applications.
Do you mean for all your Office apps, or just for Access.

VBA works for specific applications, and for specific "documents" in those applications - that is, a VBA function I write in Acccess would work in that specific Access database. It would not function for other Access databases, unless I copied that code over to the second database. Similarly, it would also not work in an Excel  workbook, or a Word document, unless I copied that code over and set up that Workbook or Document to fire off that code based on some event.

In other words - VBA cannot run in a stand-alone mode. It must be run within the context of an application (after all, it's not known as Visual Basic for Applications for nothing).
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Closing Comment

by:rreiss60
ID: 39758299
Yes, I plan to use it with Microsoft applications.  I was hoping that the abbreviation and replacement text could reside in a table in Access and be called by the VBA running in Word.
0
 
LVL 84
ID: 39758912
Word can connect into an Access database quite easily. Just include a reference to the DAO library, or the Microsoft Access Object library for 2007/2010, and use code like this to open the table:

Dim dbs As DAO.Database
Set dbs = OpenDatabase("Full path to your Access database")

If you do this when you open your Word document, then you'd have a connection to your Access database, and could use that "dbs" object to get the information from your table.

Of course, you'd have to do this for every document. You could create a Template, or modify the Normal template, to include this code. But it wouldn't work for document you receive from others, unless you copy/paste your "autotext" code into the relevant events for that document.
0
 

Author Comment

by:rreiss60
ID: 39762164
Thank you.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

785 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