Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 12-15-2015, 08:02 AM
gmayor's Avatar
gmayor gmayor is offline How to replace WordBasic.AutoCorrectNow in an old macro? Windows 10 How to replace WordBasic.AutoCorrectNow in an old macro? Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The difficulty with creating a function to perform an autocorrect on a text is in determining what to autocorrect. Auto correct entries can be longer than a word and can include punctuation which throws out the potential word count. The only solution I can see would be to select the text you wish you check against the autocorrect list and then run the macro - something like
Code:
Sub ApplyAutoCorrect()
Dim i As Long
Dim orng As Range
    Set orng = Selection.Range
    orng.MoveStartWhile Chr(32)
    orng.MoveEndWhile Chr(32), wdBackward
    If Len(orng) > 0 Then
        For i = 1 To Word.Application.AutoCorrect.Entries.Count
            If orng.Text = Word.Application.AutoCorrect.Entries(i).Name Then
                Word.Application.AutoCorrect.Entries(i).Apply orng
                Exit For
            End If
        Next i
    End If
lbl_Exit:
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 

Tags
autocorrectnow



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro on Search and Replace davidhuy Word VBA 1 12-19-2014 04:47 AM
Need Macro to Replace Text rsrasc Word VBA 2 11-10-2014 06:26 PM
Windows 95 WordBasic (!!!) macro NobodysPerfect Word VBA 4 08-25-2014 02:03 AM
How to replace WordBasic.AutoCorrectNow in an old macro? Find and Replace Macro amparete13 PowerPoint 3 03-11-2014 05:29 AM
How to replace WordBasic.AutoCorrectNow in an old macro? Macro - replace with condition ubns Word VBA 1 05-02-2012 12:52 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:38 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft