Home All Groups Group Topic Archive Search About

VB.NET Winforms app + MSWord (for spellcheck)?

Author
30 May 2006 2:53 PM
Ben R.
Hi,

I'm trying to take advantage of Word's spellchecker from a vb.net app. I get
this to work but I have a lot of questions about deployment.  First, after I
add the appropriate COM reference in VS.NET 2005, is there an extra .NET
assembly that I need to include with the project to make it function
properly? I ask because I tried running on a different machine with word and
it said that the assembly wasn't found even though Word is installed. (It
worked properly on the development machine.) If it does need this assembly,
can i somehow staticlaly link it in so it's not in a separate file or is that
unsupported?

Also, do I need to decide at buildtime if I want to use word 10 or 11? Is
there any way I can have it test and use either?

Thanks...

-Ben

Author
30 May 2006 7:58 PM
PJ on Development
Hi, Ben...

Well... Interop with COM objects has always some quirks.

When I need to use COM objects, I always use early-binding (a.k.a.
References) through out the development phase, in order to take
advantage of Intellisense, strong typing, etc.

But when the project is ready to ship, I change to late-binding (a.k.a.
CreateObject) and I check if the object was properly created before
using it.

As for what version of MS Word you use... well... I believe that any
version since Word6 has the ability to be scripted through COM, so as
long as the object is created (using CreateObject("Word.Application") )
you're good to go.

Just keep in mind to check if the object was created, avoiding to throw
an unhandled exception to the user (it's always uggly at best)... And
to remove the reference from the project before shipment.

Regards,

PJ.
http://pjondevelopment.50webs.com

Ben R. wrote:
Show quoteHide quote
> Hi,
>
> I'm trying to take advantage of Word's spellchecker from a vb.net app. I get
> this to work but I have a lot of questions about deployment.  First, after I
> add the appropriate COM reference in VS.NET 2005, is there an extra .NET
> assembly that I need to include with the project to make it function
> properly? I ask because I tried running on a different machine with word and
> it said that the assembly wasn't found even though Word is installed. (It
> worked properly on the development machine.) If it does need this assembly,
> can i somehow staticlaly link it in so it's not in a separate file or is that
> unsupported?
>
> Also, do I need to decide at buildtime if I want to use word 10 or 11? Is
> there any way I can have it test and use either?
>
> Thanks...
>
> -Ben
Author
30 May 2006 8:09 PM
Ben R.
Hi PJ,

Thanks for the info. one question, though: Once you remove the reference
(before shipping), how exactly do you instantiate the object? The
CreateObject function is not a vb.net function but a vb function, correct?

-Ben

Show quoteHide quote
"PJ on Development" wrote:

> Hi, Ben...
>
> Well... Interop with COM objects has always some quirks.
>
> When I need to use COM objects, I always use early-binding (a.k.a.
> References) through out the development phase, in order to take
> advantage of Intellisense, strong typing, etc.
>
> But when the project is ready to ship, I change to late-binding (a.k.a.
> CreateObject) and I check if the object was properly created before
> using it.
>
> As for what version of MS Word you use... well... I believe that any
> version since Word6 has the ability to be scripted through COM, so as
> long as the object is created (using CreateObject("Word.Application") )
> you're good to go.
>
> Just keep in mind to check if the object was created, avoiding to throw
> an unhandled exception to the user (it's always uggly at best)... And
> to remove the reference from the project before shipment.
>
> Regards,
>
> PJ.
> http://pjondevelopment.50webs.com
>
> Ben R. wrote:
> > Hi,
> >
> > I'm trying to take advantage of Word's spellchecker from a vb.net app. I get
> > this to work but I have a lot of questions about deployment.  First, after I
> > add the appropriate COM reference in VS.NET 2005, is there an extra .NET
> > assembly that I need to include with the project to make it function
> > properly? I ask because I tried running on a different machine with word and
> > it said that the assembly wasn't found even though Word is installed. (It
> > worked properly on the development machine.) If it does need this assembly,
> > can i somehow staticlaly link it in so it's not in a separate file or is that
> > unsupported?
> >
> > Also, do I need to decide at buildtime if I want to use word 10 or 11? Is
> > there any way I can have it test and use either?
> >
> > Thanks...
> >
> > -Ben
>
>
Author
31 May 2006 6:45 AM
Peter Huang" [MSFT]
Hi Ben,

CreateObject is still supported by VB.NET.
We can use it just as we do in VB6.

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.