|
-
Nov 7th, 2001, 05:37 AM
#1
Resolved ***** MSWord Dictionary
In an effort to learn (alot) more VB, I am thinking of making a
small dictionary utility.
My question is, can you 'tap' into the MSWord dictionary
without running the MSWord App?
I'm also open to suggestions 
Cheers,
Bruce.
________
Hot_Zouvineir
Last edited by Bruce Fox; Aug 14th, 2011 at 03:58 AM.
-
Nov 7th, 2001, 05:52 AM
#2
Ooops
Sorry, I also ment to say, if opening MSWord was the only way
to go, can it be done in the background.
The idea being a simple form, with a text box containg the
search string, and a results/suggestion list.
Bruce.
________
HERBALAIRE VAPORIZER
Last edited by Bruce Fox; Aug 14th, 2011 at 03:58 AM.
-
Nov 7th, 2001, 06:05 AM
#3
Conquistador
In word, you can do it like this:
VB Code:
Dim wdApp As New Word
Set sugList = wdApp.GetSpellingSuggestions("homicydal")
If sugList.Count = 0 Then
MsgBox "No suggestions were found"
Else
For Each sug In sugList
MsgBox sug.Name
Next sug
End If
Something like that
-
Nov 7th, 2001, 06:21 AM
#4
Word?
Sorry Dave, Forgive my ignorance 
Does your example go in VB or Word?
Cheers
Bruce.
-
Nov 7th, 2001, 06:29 AM
#5
Conquistador
Word, What version of word do you have?
You can put that into VB with a few modifications
-
Nov 7th, 2001, 06:39 AM
#6
Conquistador
1. In visual basic, click Project (menu) then References,
2. Add a reference to Microsoft Word 9.0 Object Library
3. Add a textbox called txtStr to your VB form
3. Add a listbox called lstSug to your VB form
4. Add the following code to your VB form
VB Code:
Dim wdApp As New Word.Application
Dim wdDoc As Word.Document
Private Sub Form_Load()
Set wdDoc = wdApp.Documents.Add
txtStr = ""
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Clean up
Set wdDoc = Nothing
Set wdApp = Nothing
End Sub
Private Sub txtStr_Change()
lstSug.Clear
Set sugList = wdApp.GetSpellingSuggestions(txtStr) 'Get the suggestions
If sugList.Count = 0 Then
lstSug.AddItem "No suggestions were found"
Else
For Each sug In sugList
lstSug.AddItem sug.Name
Next sug
End If
End Sub
It will find suggestions for all new input in the textbox
-
Nov 7th, 2001, 06:53 AM
#7
Thanks Dave
Ahhh,
Things are alot clearer now! Cheers.
I have Office 97.
What I can't seem to find is the Microsoft Word 9.0 Object Library
reference. It's not in my list.
Bruce.
________
California Medical Marijuana Dispensaries
Last edited by Bruce Fox; Aug 14th, 2011 at 03:59 AM.
-
Nov 7th, 2001, 07:01 AM
#8
Conquistador
Then go down a version...
Maybe Word 8.0 Object Library?
-
Nov 7th, 2001, 07:28 AM
#9
Thanks Again
That did it.
I must be blind, I didn't even see the reference to Word 8!
Works fine (slight glitch I'll iron out).
Anyway, did you just knock up that code or did you have it coded
already?
Well, Thanks for your help Dave.
Bruce.
________
SophiaHot
Last edited by Bruce Fox; Aug 14th, 2011 at 03:59 AM.
-
Nov 7th, 2001, 07:57 AM
#10
Conquistador
-
Nov 7th, 2001, 09:26 AM
#11
I'm Stuck
When closing this app (using the x)
I notice 'Winword' is still active (using Ctrl-Alt-Del).
I have unsuccesfully tried adding to the Form_Unload sub.
the following in an attempt to close off Winword:
Set wdDoc.Close, Set wdApp.Application.close
wdDoc.Close = true......... Clutching at straws!
Hmmmmm.
I have done a search, and I have found heaps using
Kill, Public Function.... yada yada yada.
They seem to deal with Active windows apps though.
Bruce 
________
HOW TO ROLL A JOINT
Last edited by Bruce Fox; Aug 14th, 2011 at 03:59 AM.
-
Nov 7th, 2001, 03:29 PM
#12
Conquistador
Application.Quit should work...
I don't know if i've declared Word correctly
-
Nov 7th, 2001, 09:47 PM
#13
Yep
The word declaration is OK.
Had to use:
Word.Application.Quit
in the Unload_Form aswell to close of Winword.
Thanks again.
Bruce 
________
lesbians Webcam
Last edited by Bruce Fox; Aug 14th, 2011 at 03:59 AM.
-
Nov 8th, 2001, 01:35 AM
#14
Conquistador
Yeah, woops, thought i had put that in
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
|