We used to have Outlook 2000 with Word 2000 and I used the automation code
below which worked fine. We then migrated to Outlook 2003 with Word 2000 and
the same piece of code does not work. What am I missing? Pls help. See code
below:

Dim myOutlook As Object
Dim myInspector As Object

On Error Resume Next

Set myOutlook = GetObject(, "Outlook.Application")

If myOutlook Is Nothing Then
Set myOutlook = CreateObject("Outlook.Application")
End If

On Error GoTo 0

If myOutlook Is Nothing Then
MsgBox "Application Not Available"
End If

Set myInspector = myOutlook.ActiveInspector
myInspector.Activate
MsgBox myInspector.CurrentItem.Subject, vbInformation

Set myOutlook = Nothing

Re: Automation Between Outlook 2003 and Word 2000 by Doug

Doug
Sat Nov 13 07:34:24 CST 2004

Do you have a reference set to the correct Outlook Object Library -
Microsoft Outlook 11.0 Object Library - in the case of Outlook 2003.

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
"blgsai" <blgsai@discussions.microsoft.com> wrote in message
news:2F2F71A3-51B1-4534-893B-41255AE11D6A@microsoft.com...
> We used to have Outlook 2000 with Word 2000 and I used the automation code
> below which worked fine. We then migrated to Outlook 2003 with Word 2000
> and
> the same piece of code does not work. What am I missing? Pls help. See
> code
> below:
>
> Dim myOutlook As Object
> Dim myInspector As Object
>
> On Error Resume Next
>
> Set myOutlook = GetObject(, "Outlook.Application")
>
> If myOutlook Is Nothing Then
> Set myOutlook = CreateObject("Outlook.Application")
> End If
>
> On Error GoTo 0
>
> If myOutlook Is Nothing Then
> MsgBox "Application Not Available"
> End If
>
> Set myInspector = myOutlook.ActiveInspector
> myInspector.Activate
> MsgBox myInspector.CurrentItem.Subject, vbInformation
>
> Set myOutlook = Nothing



Re: Automation Between Outlook 2003 and Word 2000 by blgsai

blgsai
Mon Nov 15 09:44:09 CST 2004

Yes I do have a reference to the object library.

"Doug Robbins" wrote:

> Do you have a reference set to the correct Outlook Object Library -
> Microsoft Outlook 11.0 Object Library - in the case of Outlook 2003.
>
> --
> Please respond to the Newsgroup for the benefit of others who may be
> interested. Questions sent directly to me will only be answered on a paid
> consulting basis.
>
> Hope this helps,
> Doug Robbins - Word MVP
> "blgsai" <blgsai@discussions.microsoft.com> wrote in message
> news:2F2F71A3-51B1-4534-893B-41255AE11D6A@microsoft.com...
> > We used to have Outlook 2000 with Word 2000 and I used the automation code
> > below which worked fine. We then migrated to Outlook 2003 with Word 2000
> > and
> > the same piece of code does not work. What am I missing? Pls help. See
> > code
> > below:
> >
> > Dim myOutlook As Object
> > Dim myInspector As Object
> >
> > On Error Resume Next
> >
> > Set myOutlook = GetObject(, "Outlook.Application")
> >
> > If myOutlook Is Nothing Then
> > Set myOutlook = CreateObject("Outlook.Application")
> > End If
> >
> > On Error GoTo 0
> >
> > If myOutlook Is Nothing Then
> > MsgBox "Application Not Available"
> > End If
> >
> > Set myInspector = myOutlook.ActiveInspector
> > myInspector.Activate
> > MsgBox myInspector.CurrentItem.Subject, vbInformation
> >
> > Set myOutlook = Nothing
>
>
>

Re: Automation Between Outlook 2003 and Word 2000 by Jean-Guy

Jean-Guy
Mon Nov 15 10:03:44 CST 2004

blgsai was telling us:
blgsai nous racontait que :

> We used to have Outlook 2000 with Word 2000 and I used the automation
> code below which worked fine. We then migrated to Outlook 2003 with
> Word 2000 and the same piece of code does not work. What am I
> missing? Pls help. See code below:

"does not work" is kind of vague.
What exaclty happens? When you debug, which line throws the error? Do you
get an error message? If so, what is it?
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org




Re: Automation Between Outlook 2003 and Word 2000 by blgsai

blgsai
Mon Nov 15 11:20:02 CST 2004

Run-time error 429 - ActiveX can't create object. Thx.

"Jean-Guy Marcil" wrote:

> blgsai was telling us:
> blgsai nous racontait que :
>
> > We used to have Outlook 2000 with Word 2000 and I used the automation
> > code below which worked fine. We then migrated to Outlook 2003 with
> > Word 2000 and the same piece of code does not work. What am I
> > missing? Pls help. See code below:
>
> "does not work" is kind of vague.
> What exaclty happens? When you debug, which line throws the error? Do you
> get an error message? If so, what is it?
> --
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site: http://www.word.mvps.org
>
>
>
>

Re: Automation Between Outlook 2003 and Word 2000 by Doug

Doug
Mon Nov 15 22:41:38 CST 2004

And what line of code is highlighted when the error occurs

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
"blgsai" <blgsai@discussions.microsoft.com> wrote in message
news:6D23DB7D-8CEF-48C7-A487-52DF505CEEF7@microsoft.com...
> Run-time error 429 - ActiveX can't create object. Thx.
>
> "Jean-Guy Marcil" wrote:
>
>> blgsai was telling us:
>> blgsai nous racontait que :
>>
>> > We used to have Outlook 2000 with Word 2000 and I used the automation
>> > code below which worked fine. We then migrated to Outlook 2003 with
>> > Word 2000 and the same piece of code does not work. What am I
>> > missing? Pls help. See code below:
>>
>> "does not work" is kind of vague.
>> What exaclty happens? When you debug, which line throws the error? Do you
>> get an error message? If so, what is it?
>> --
>> Salut!
>> _______________________________________
>> Jean-Guy Marcil - Word MVP
>> jmarcilREMOVE@CAPSsympatico.caTHISTOO
>> Word MVP site: http://www.word.mvps.org
>>
>>
>>
>>



Re: Automation Between Outlook 2003 and Word 2000 by blgsai

blgsai
Tue Nov 16 12:14:03 CST 2004

It fails at Line 1 and if I comment out Lines 1, 2 and 4 and leave just line
3, it still fails at line 3.
1: Set myOutlook = GetObject(, "Outlook.Application")

2: If myOutlook Is Nothing Then
3: Set myOutlook = CreateObject("Outlook.Application")
4: End If

I made sure to check that the project has the references and I have the
following references:
- Visual Basic for Applications
- Microsoft Word 9.0 Object Library
- OLE Automation
- Microsoft Office 9.0 Object Library
- Microsoft Outlook 11.0 Object Library
- Microsoft Forms 2.0 Object Library

Thx.

"Doug Robbins" wrote:

> And what line of code is highlighted when the error occurs
>
> --
> Please respond to the Newsgroup for the benefit of others who may be
> interested. Questions sent directly to me will only be answered on a paid
> consulting basis.
>
> Hope this helps,
> Doug Robbins - Word MVP
> "blgsai" <blgsai@discussions.microsoft.com> wrote in message
> news:6D23DB7D-8CEF-48C7-A487-52DF505CEEF7@microsoft.com...
> > Run-time error 429 - ActiveX can't create object. Thx.
> >
> > "Jean-Guy Marcil" wrote:
> >
> >> blgsai was telling us:
> >> blgsai nous racontait que :
> >>
> >> > We used to have Outlook 2000 with Word 2000 and I used the automation
> >> > code below which worked fine. We then migrated to Outlook 2003 with
> >> > Word 2000 and the same piece of code does not work. What am I
> >> > missing? Pls help. See code below:
> >>
> >> "does not work" is kind of vague.
> >> What exaclty happens? When you debug, which line throws the error? Do you
> >> get an error message? If so, what is it?
> >> --
> >> Salut!
> >> _______________________________________
> >> Jean-Guy Marcil - Word MVP
> >> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> >> Word MVP site: http://www.word.mvps.org
> >>
> >>
> >>
> >>
>
>
>

Re: Automation Between Outlook 2003 and Word 2000 by Jean-Guy

Jean-Guy
Tue Nov 16 20:38:47 CST 2004

blgsai was telling us:
blgsai nous racontait que :

> It fails at Line 1 and if I comment out Lines 1, 2 and 4 and leave
> just line 3, it still fails at line 3.
> 1: Set myOutlook = GetObject(, "Outlook.Application")
>
> 2: If myOutlook Is Nothing Then
> 3: Set myOutlook = CreateObject("Outlook.Application")
> 4: End If
>
> I made sure to check that the project has the references and I have
> the following references:
> - Visual Basic for Applications
> - Microsoft Word 9.0 Object Library
> - OLE Automation
> - Microsoft Office 9.0 Object Library
> - Microsoft Outlook 11.0 Object Library
> - Microsoft Forms 2.0 Object Library
>
Have you tried changing

Dim myOutlook As Object
Dim myInspector As Object

to

Dim myOutlook As Outlook.Application
Dim myInspector As Outlook.Inspector

I think it is better to use explicit assignments whenever you can.
Maybe your code was working under Word/Outlook 2000 because the compiler
correctly guessed what kind of object myOutlook was.
Now that you are using an Outlook version that is different from the Word
one, maybe the compiler cannot guess anymore.

It may be an Ealry vs Late binding issue.
Normally, we use
Dim myOutlook As Object
in late binding, but you use early binding...

See
http://word.mvps.org/faqs/interdev/EarlyvsLateBinding.htm
for more on the pros/cons of Early/Late binding.

If not, have you tried posting in an Outlook group?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org




Re: Automation Between Outlook 2003 and Word 2000 by blgsai

blgsai
Wed Nov 17 13:29:07 CST 2004

Thank You - that worked. I know I tried it but I must have missed something
because it now works using early binding. I really appreciate it. Thx.

"Jean-Guy Marcil" wrote:

> blgsai was telling us:
> blgsai nous racontait que :
>
> > It fails at Line 1 and if I comment out Lines 1, 2 and 4 and leave
> > just line 3, it still fails at line 3.
> > 1: Set myOutlook = GetObject(, "Outlook.Application")
> >
> > 2: If myOutlook Is Nothing Then
> > 3: Set myOutlook = CreateObject("Outlook.Application")
> > 4: End If
> >
> > I made sure to check that the project has the references and I have
> > the following references:
> > - Visual Basic for Applications
> > - Microsoft Word 9.0 Object Library
> > - OLE Automation
> > - Microsoft Office 9.0 Object Library
> > - Microsoft Outlook 11.0 Object Library
> > - Microsoft Forms 2.0 Object Library
> >
> Have you tried changing
>
> Dim myOutlook As Object
> Dim myInspector As Object
>
> to
>
> Dim myOutlook As Outlook.Application
> Dim myInspector As Outlook.Inspector
>
> I think it is better to use explicit assignments whenever you can.
> Maybe your code was working under Word/Outlook 2000 because the compiler
> correctly guessed what kind of object myOutlook was.
> Now that you are using an Outlook version that is different from the Word
> one, maybe the compiler cannot guess anymore.
>
> It may be an Ealry vs Late binding issue.
> Normally, we use
> Dim myOutlook As Object
> in late binding, but you use early binding...
>
> See
> http://word.mvps.org/faqs/interdev/EarlyvsLateBinding.htm
> for more on the pros/cons of Early/Late binding.
>
> If not, have you tried posting in an Outlook group?
>
> --
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site: http://www.word.mvps.org
>
>
>
>