Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AutoCorrect - Office Word, Excel

Status
Not open for further replies.

irkey

MIS
Sep 23, 2002
14
0
0
CA
Hi,

Can anyone tell me how to convert this VBA code to vbscript...or if this is even possible???? I was told that any VB code can be converted to vbscript.

Sub AutoCorrectCaptureWORD()
'
' AutoCorrectCapture Macro
'
AutoCorrect.Entries.Add Name:="test", Value:="TEST"
With AutoCorrect
.CorrectInitialCaps = True
.CorrectSentenceCaps = False
.CorrectDays = True
.CorrectCapsLock = True
.ReplaceText = True
.ReplaceTextFromSpellingChecker = True
.CorrectKeyboardSetting = False
End With
End Sub

Sub AutoCorrectCaptureEXCEL()
'
' AutoCorrectCapture Macro
'

'
Application.AutoCorrect.AddReplacement What:="test", Replacement:="TEST"
With Application.AutoCorrect
.TwoInitialCapitals = True
.CorrectSentenceCap = True
.CapitalizeNamesOfDays = True
.CorrectCapsLock = True
.ReplaceText = True
End With
End Sub
 
You can try this (in a .vbs file):
Code:
Set W=WScript.CreateObject("Word.Application")
With W.AutoCorrect
  .Entries.Add "test","TEST"
  .CorrectInitialCaps=True
  .CorrectSentenceCaps=False
  .CorrectDays=True
  .CorrectCapsLock=True
  .ReplaceText=True
  .ReplaceTextFromSpellingChecker=True
  .CorrectKeyboardSetting=False
End With
W.Quit
Similar thing for Excel:
Code:
Set X=WScript.CreateObject("Excel.Application")
With X.AutoCorrect
  .AddReplacement "test","TEST"
  .TwoInitialCapitals=True
  .CorrectSentenceCap=True
  .CapitalizeNamesOfDays=True
  .CorrectCapsLock=True
  .ReplaceText=True
End With
X.Quit
Main diffs between VBA and VBS are named parameter,typed var and goto.

Hope This Help
PH.
 
Thanks a million PHV. Your code for Word worked great! But the code for Excel is not working for some reason.
 
Worked for me: new replacement added and all options checked
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top