Solved

Need VBA solution for autotext replacement like Phrase Express or Robotype

Posted on 2014-01-05
6
824 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 85

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
Industry Leaders: 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!

 

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 85
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

Technology Partners: 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!

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
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…

717 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