|
-
Nov 23rd, 2003, 02:30 PM
#1
Thread Starter
Junior Member
User defined type error when tyring to use word's SpellingSuggetions
Can someone tell me what I'm doing wrong? I get a compile error saying 'User-defined type not defined' when trying to declare a variable of type spellingsuggestions (word automation).
I can create an instance of the word object and use various other methods/properties of it which all work fine. But as soon as I try to
VB Code:
Dim SpellSuggestions as wdapp.spellingsuggestions
I get the error.
wdApp is created using the code
VB Code:
Dim wdApp As Object
Set wdApp = CreateObject("Word.Application")
I'm fairly new at this automation stuff, so if its a stupid mistake on my part that is glaringly obvious to everyone else, please forgive my ignorance.
Cheers.
-
Nov 28th, 2003, 06:43 PM
#2
Since you are using late-binding to create the word object I am assuming you do not have a reference to the Word library in your vb project.
This means you would have to declare the SpellSuggestions variable as an Object as well.
VB Code:
Dim SpellSuggestions as Object
Set SpellSuggestions = wdapp.GetSpellingSuggestions("Incorect")
-
Dec 9th, 2003, 02:46 PM
#3
Thread Starter
Junior Member
Ah, so it was a stupid mistake on my part.
I had written the code originally using early binding and thus with a reference to the Word type library.
I am currently writing v2 of the app of which this code is part, using late binding as the users have different versions of office.
Thanks for your help brucevde, it works perfectly.
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
|