|
-
Apr 29th, 2006, 11:38 PM
#1
Thread Starter
Lively Member
Turning on autocorrect on in a TextBox
Does anyone know how to turn autocorrect on in a TextBox in Word?
caz
-
Apr 30th, 2006, 12:17 AM
#2
Re: Turning on autocorrect on in a TextBox
To turn on spelling as you type...
VB Code:
Options.CheckSpellingAsYouType = True
But to check spelling in an ActiveX or Forms Textbox you will need to code the spellchecking manually as Word does not check them.
Check out the code example in my signature "VB/Office Guru Advanced SpellChecker™ for VB6" as it shows the technique you will need to do.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 30th, 2006, 05:34 AM
#3
Thread Starter
Lively Member
Re: Turning on autocorrect on in a TextBox
Thanks robb, thats not really what i wanted though, Unless it is and my inexperience is showing. i wanted to turn autocorrect on.
caz
-
Apr 30th, 2006, 01:24 PM
#4
Re: Turning on autocorrect on in a TextBox
Well I was getting at the fact that you can not autocorrect text as you type in anything other then the document and not in any ActiveX controls like a textbox. You would have to pass the textbox contents to some custom function that looks it up in a dictionry and then replace it.
There is another possibility, download the smart tag sdk from ms and create your own smart tag for duplicating the autocorrect but in the textbox.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 1st, 2006, 06:26 AM
#5
Thread Starter
Lively Member
Re: Turning on autocorrect on in a TextBox
Okay thanks robb. I am going to try and use the find/replace function. I have created a program in VB6 which translated the words from an access database.
I am going to see if i can convert it to VBA code any help would be much appreciated.
caz
VB Code:
Private db As Database
Private rs As Recordset
Private Sub Form_Load()
Set db = OpenDatabase("C:\Documents and Settings\Matthew\Desktop\TEST.mdb")
Set rs = db.OpenRecordset("tblTEST", dbOpenDynaset)
End Sub
Private Sub Text1_Change()
End Sub
Private Sub txtSearchText_KeyUp(KeyAscii As Integer, Shift As Integer)
Dim Prts() As String
Dim tmpText As String
If KeyAscii = 32 Or KeyAscii = 46 Then
If txtSearchText.Text <> "" Then
tmpText = txtSearchText
Prts = Split(txtSearchText.Text, " ")
For x = 0 To UBound(Prts)
rs.FindFirst "[SearchText] = '" & Prts(x) & "'"
If Not rs.NoMatch Then
tmpText = Replace(tmpText, Prts(x), rs.Fields("ReplacementText"))
End If
Next
Text1 = tmpText
End If
End If
End Sub
Last edited by caz1805; May 1st, 2006 at 02:46 PM.
-
May 1st, 2006, 03:02 PM
#6
Re: Turning on autocorrect on in a TextBox
Find and Replace do not search in an ActiveX textbox control. It will only work in the contents of a document. You will have to iterate through the textboxes on your document and code the find/replace.
Why are you using a db for the replaced text?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 1st, 2006, 03:08 PM
#7
Thread Starter
Lively Member
Re: Turning on autocorrect on in a TextBox
I was using a database as I had a large amount of words to be replaced and that program completed it on the 'fly' like autocorrect. Thats why i was looking into autocorrect as a possible and easier solution but to no avail.
caz
-
May 1st, 2006, 03:15 PM
#8
Re: Turning on autocorrect on in a TextBox
Oh, ok. So is the code working for you? What version of Access?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 1st, 2006, 03:28 PM
#9
Thread Starter
Lively Member
Re: Turning on autocorrect on in a TextBox
Yeh the code works in VB6 with Word and Access 2002.
With your expertise and excvellent knowledge do you believe i could do this in WOrd?
caz
-
May 1st, 2006, 03:37 PM
#10
Re: Turning on autocorrect on in a TextBox
Sure, looks like your using DAO so in the VBA IDE add a reference to DAO 3.6 and add your code. There is no Form_Load but change it to Document_Open.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 1st, 2006, 03:49 PM
#11
Thread Starter
Lively Member
Re: Turning on autocorrect on in a TextBox
thanks alot robb
I am getting stumped because the VB6 program was all based on textboxes and u said i could not do this in VBA. So how would i recreate this with the ActiveDocument. Or even so that i type it into the ActiveDocument and it is replaced into the TextBox?
i am going to try soi will let u know if i figure out how to do it,
]
caz
-
May 2nd, 2006, 11:03 AM
#12
Re: Turning on autocorrect on in a TextBox
Post your updates code. If its a straight replace then the textbox keypress event should suffice.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 3rd, 2006, 04:53 PM
#13
Thread Starter
Lively Member
Re: Turning on autocorrect on in a TextBox
Hi guys me again, I have managed to create the form and get nearly everything working except that the keyup does not seem to be firing. So it is going along without the replacement text being sent to textbox1 from textbox2.
All the files are being referenced to and everything its something to do with the keyup and keyspace button but i just cant figure it out.
thanks for any help.
caz
p.s. Robbdog do u never sleep!!!
VB Code:
Private Sub TextBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Dim Prts() As String
Dim tmpText As String
If KeyAscii = 32 Or KeyAscii = 46 Then
If TextBox2.Text <> "" Then
tmpText = TextBox2.Text
Prts = Split(TextBox2.Text, " ")
For x = 0 To UBound(Prts)
rs.FindFirst "[SearchText] = '" & Prts(x) & "'"
If Not rs.NoMatch Then
tmpText = Replace(tmpText, Prts(x), rs.Fields("ReplacementText"))
End If
Next
TextBox2.Text = tmpText
End If
End If
End Sub
-
May 4th, 2006, 11:17 AM
#14
Thread Starter
Lively Member
Re: Turning on autocorrect on in a TextBox
any help would be great.
caz
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|