-
Aug 27th, 2009, 10:05 PM
#81
Hyperactive Member
Re: Advanced VB/Office Guru™ SpellChecker™
A little too complicated for me. I think I'll just
stick with trying to figure out how to disable the
visualizations in Window Media Player control,
using a button. Is there a code for that?
I'd like to give the user an option to use it or not.
-
Aug 28th, 2009, 01:16 AM
#82
Re: Advanced VB/Office Guru™ SpellChecker™
Its not hard. If you look at teh two coding examples of Early vs Late you can see the only differences are ...
Early:
Add a reference to Word (or whatever you are automating)
Late:
No reference needed
Declare variables as Object
Declare Constants yourself as no reference means they wont be declared
For the WMP question, have you tried a search yet?
Ps, dont give up so soon.
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 
-
Aug 28th, 2009, 07:43 AM
#83
Hyperactive Member
Re: Advanced VB/Office Guru™ SpellChecker™
Thanks for the encouragement.
Last edited by GARY MICHAEL; Aug 28th, 2009 at 07:57 AM.
Thanks,
GARY
-
Aug 28th, 2009, 12:10 PM
#84
Re: Advanced VB/Office Guru™ SpellChecker™
Post up any more questions or issues you come across and we all would be happy to help.
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 
-
Dec 10th, 2009, 09:35 AM
#85
Lively Member
Re: Advanced VB/Office Guru™ SpellChecker™
-
Apr 26th, 2010, 04:31 PM
#86
Addicted Member
Re: Advanced VB/Office Guru™ SpellChecker™
Good Work
-
Apr 28th, 2010, 04:30 AM
#87
New Member
Re: Advanced VB/Office Guru™ SpellChecker™
Moring All, first time here - exciting!
I'm trying to get this goint in Access for 2 reasons: 1. it looks awsome and I like it therfore I want to (already got the built in one working fine but you know ) 2. Acess 2007 runtime doesn't have a spell check and I need to add one.
I've imported the code and popped it into a new module. I've already got a reference to word 11 so I'm guessing I'm in with early binding (in 2003 at the mo, work out 2007 later).
Just running debug and had to change the mouse pointer to 11 which makes me think I should be using late binding?? Anyway, whilst debuggin, it stops at App.OleRequestPendingTimeout = 999999 with a variable not defined - I'm guessing I need to either add a reference or make a change in accordance with late binding? Not sure how though, any help would be greatly appreciated.
Martyn
-
Jul 14th, 2011, 02:26 AM
#88
New Member
Re: Advanced VB/Office Guru™ SpellChecker™
I have been using this code quite successfully for some time but have now hit a problem. The scenario is a VB6.0 application using Office 2010 spell check. Sometimes it works and sometimes the users get a message stating that Spell check is currently unavailable. Below is the code from my app:
Code:
Public Function SpellMe(ByVal msSpell As String) As String
On Error GoTo No_Bugs
Dim oDoc As Word.Document
Dim iWSE As Integer
Dim iWGE As Integer
Dim sReplace As String
Dim lresp As Long
If msSpell = vbNullString Then Exit Function
InitializeMe
If gDiags Then
frmDiags.AddLine moApp.Version
End If
Select Case moApp.Version
Case "9.0", "10.0", "11.0", "12.0", "14.0"
Set oDoc = moApp.Documents.Add(, , 1, True)
Case "8.0"
Set oDoc = moApp.Documents.Add
Case Else
MsgBox "Unsupported Version of Word.", vbOKOnly + vbExclamation, "VB/Office Guru™ SpellChecker™"
Exit Function
End Select
Screen.MousePointer = vbHourglass
App.OleRequestPendingTimeout = 999999
oDoc.Words.First.InsertBefore msSpell
iWSE = oDoc.SpellingErrors.count
iWGE = oDoc.GrammaticalErrors.count
'<CHECK SPELLING AND GRAMMER DIALOG BOX>
If iWSE > 0 Or iWGE > 0 Then
'<HIDE MAIN WORD WINDOW>
moApp.Visible = False
If (moApp.WindowState = wdWindowStateNormal) Or (moApp.WindowState = wdWindowStateMaximize) Then
moApp.WindowState = wdWindowStateMinimize
Else
moApp.WindowState = wdWindowStateMinimize
End If
'</HIDE MAIN WORD WINDOW>
'<PREP CHECK SPELLING OPTIONS DIALOG BOX (MODIFY TO YOUR PREFERENCES)>
moApp.Dialogs(wdDialogToolsSpellingAndGrammar).Application.options.CheckGrammarWithSpelling = True
moApp.Dialogs(wdDialogToolsSpellingAndGrammar).Application.options.SuggestSpellingCorrections = True
moApp.Dialogs(wdDialogToolsSpellingAndGrammar).Application.options.IgnoreUppercase = True
moApp.Dialogs(wdDialogToolsSpellingAndGrammar).Application.options.IgnoreInternetAndFileAddresses = True
moApp.Dialogs(wdDialogToolsSpellingAndGrammar).Application.options.IgnoreMixedDigits = False
moApp.Dialogs(wdDialogToolsSpellingAndGrammar).Application.options.ShowReadabilityStatistics = False
'</PREP CHECK SPELLING OPTIONS DIALOG BOX (MODIFY TO YOUR PREFERENCES)>
'<DO ACTUAL SPELL CHECKING>
moApp.Visible = True
moApp.Activate
lresp = moApp.Dialogs(wdDialogToolsSpellingAndGrammar).display
'</DO ACTUAL SPELL CHECKING>
If lresp < 0 Then
moApp.Visible = True
MsgBox "Corrections Being Updated!", vbOKOnly + vbInformation, App.ProductName
Clipboard.Clear
oDoc.Select
oDoc.Range.copy
sReplace = Clipboard.GetText(1)
'<FIX FOR POSSIBLE EXTRA LINE BREAK AT END OF TEXT>
If (InStrRev(sReplace, Chr(13) & Chr(10))) = (Len(sReplace) - 1) Then
sReplace = Mid$(sReplace, 1, Len(sReplace) - 2)
End If
'</FIX FOR POSSIBLE EXTRA LINE BREAK AT END OF TEXT>
SpellMe = sReplace
ElseIf lresp = 0 Then
MsgBox "Spelling Corrections Have Been Canceled!", vbOKOnly + vbCritical, "VB/Office Guru™ SpellChecker"
SpellMe = msSpell
End If
Else
MsgBox "No Spelling Errors Found" & vbNewLine & "Or No Suggestions Available!", vbOKOnly + vbInformation, _
"VB/Office Guru™ SpellChecker"
SpellMe = msSpell
End If
'</CHECK SPELLING AND GRAMMER DIALOG BOX>
oDoc.Close False
Set oDoc = Nothing
'<HIDE WORD IF THERE ARE NO OTHER INSTANCES>
If KillMe = True Then
moApp.Visible = False
End If
'</HIDE WORD IF THERE ARE NO OTHER INSTANCES>
Screen.MousePointer = vbNormal
Exit Function
No_Bugs:
If err.Number = "91" Then
Resume Next
ElseIf err.Number = "462" Then
MsgBox "Spell Checking Is Temporary Un-Available!" & vbNewLine & "Try Again After Program Re-Start.", _
vbOKOnly + vbInformation, "ActiveX Server Not Responding"
Screen.MousePointer = vbNormal
ElseIf err.Number = 429 Then
Set moApp = Nothing
Resume Next
Else
MsgBox err.Number & " " & err.Description, vbOKOnly + vbInformation, App.ProductName
Screen.MousePointer = vbNormal
End If
End Function
Any help would be greatly appreciated.
Thanks.
Last edited by RobDog888; Jul 15th, 2011 at 11:51 AM.
Reason: Added [code] tags
-
Jul 15th, 2011, 11:53 AM
#89
Re: Advanced VB/Office Guru™ SpellChecker™
I dont have 2010 installed on my work computer but have you tried stepping through the code to see where the hangup lies?
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 
-
Jul 19th, 2011, 02:01 AM
#90
New Member
Re: Advanced VB/Office Guru™ SpellChecker™
It fails at Set oDoc = moApp.Documents.Add(, , 1, True) in that at the next step it says "the action cannot be performed as no document is open" or "Spell Check is currently unavailable". As far as Word 2010 goes it isn't just affecting this Spell Check code but everywhere I need to automate Word.
Thanks
-
Jul 25th, 2012, 06:40 PM
#91
Junior Member
Re: Advanced VB/Office Guru™ SpellChecker™
Rob,
I reworked your code into a "drop in" class module that does it's own initializing and termination, negating the user doing so in their form code. I also added some extra properties and events. Your copyright suggests I should ask permission before posting it here. Would it be okay to do so?
Thanks!
- Kev
-
Jul 26th, 2012, 06:57 PM
#92
Junior Member
Re: Advanced VB/Office Guru™ SpellChecker™
Hopefully this thread is still being followed? Maybe? 
I discovered something in your sample that doesn't make sense, and damned if I can find the answer in MSFT's docs.
If you change the CheckGrammarWithSpelling option to false, and click Cancel on the Dialog, lResp returns -1 (versus 0 for Cancel/Close). Switching it back to True restores normal behaviour.
So, any idea why that might be?
I'm tossing around checking the spelling errors count for something > 0 as clicking Cancel does not lower the error count like Ignore does.
-
Jul 28th, 2012, 05:59 PM
#93
Re: Advanced VB/Office Guru™ SpellChecker™
If memory servers me right, the calcel/close values are not self explainatory. There is also a third value -2 which means something too.
I will dig up my old files and see what somments I have from r n d.
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 
-
Jul 29th, 2012, 11:01 AM
#94
Junior Member
Re: Advanced VB/Office Guru™ SpellChecker™
Rob -
The MSDN says the following (http://msdn.microsoft.com/en-us/libr...g.display.aspx)
-2 = The Close button.
-1 = The OK button.
0 (zero) = The Cancel button.
> 0 (zero) = A command button: 1 is the first button, 2 is the second button, and so on.
My observation is, based on the Grammar check set to false is the return value is always -1, regardless what button is clicked. Odd behaviour to say the least (but with MSFT, this is typically the norm, especially when ti comes to automating various office classes). As I noted before, I was able to compensate for this by checking for unchecked errors after the user cancels out. Couldn't figure out why the return value is so flaky, so...
I'd still like to get your permission to post my class based on your code. I think you'd find the enhancements nod worthy. ;-)
-
May 14th, 2013, 01:33 AM
#95
Registered User
Re: Advanced VB/Office Guru™ SpellChecker™
Today i have also come up with the same problem. Everything works fine but when you try to use Word 2010, it gives the following error. However my error description is slightly different
4605 The Add method or property is not available because the document is a rich text edit control.
-
May 14th, 2013, 08:07 PM
#96
Registered User
Re: Advanced VB/Office Guru™ SpellChecker™
 Originally Posted by abbid_siddiqui
Today i have also come up with the same problem. Everything works fine but when you try to use Word 2010, it gives the following error. However my error description is slightly different
4605 The Add method or property is not available because the document is a rich text edit control.
I've found out the reason for this problem but don't have any idea how to resolve this? The error occurs when there is an unclosed instance of Spell Checker in the Task Manager (don't know why it remains in task manager). If you close that and re-run the application, it works.
Rob, could you please let me know how to avoid this error?
-
Nov 25th, 2013, 03:51 PM
#97
Re: Advanced VB/Office Guru™ SpellChecker™
 Originally Posted by RobDog888
I wrote this to demonstrate how to take full advantage of MS Word's built in Spelling and Grammer checker
Oh, the irony...
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Mar 20th, 2023, 10:37 AM
#98
New Member
Re: Advanced VB/Office Guru™ SpellChecker™
I know this is an old thread but we recently starting having issues where the word that is misspelled is no longer being displayed in the 'Not in Dictionary' portion of the spell checker. I have created a new project from RobDog888 example in this thread and that is doing the same thing. Anyone else experiencing this and/or have suggestions on how to get it to display the misspelled word again? I suspect it is a MS change/update to office.
Here is an example. Thanks!
Attachment 187199
-
Mar 20th, 2023, 03:35 PM
#99
Re: Advanced VB/Office Guru™ SpellChecker™
 Originally Posted by ColinE66
Oh, the irony...
Lol!
-
Sep 13th, 2023, 05:36 PM
#100
Re: Advanced VB/Office Guru™ SpellChecker™
 Originally Posted by ColinE66
Oh, the irony...
Yup! Testing you guys to see if anyone notices.
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 
-
Sep 29th, 2023, 04:30 AM
#101
Re: Advanced VB/Office Guru™ SpellChecker™
I noticed!
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
|