problems with code in thisOutlookSession (error 438)

H

Heike Pertzel

Hallo!

In Outlook 2002 I've got following code in ThisOutlookSession:

Sub RufeBriefSchreibenAuf()
AufrufAusWord = True
Call BriefSchreiben
End Sub

In Word 2002 I wrote

Sub Test()
Dim oOutAppl As Outlook.Application

Set oOutAppl = GetObject(, "Outlook.Application")
oOutAppl.RufeBriefSchreibenAuf
End Sub

Error 438 apears. What's wrong?

Thanks and regards
Heike Pertzel / DATA 5 GmbH
 
S

Sue Mosher [MVP-Outlook]

If Outlook isn't running, GetObject will return Nothing. You need to handle that scenario:

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

Also note that the method you're using is unsupported. It works from an Outlook custom form, but I wouldn't necessarily expect it to work in other code environments.
 
H

Heike Pertzel

Hallo Sue Mosher,

thanks for your answer.

Heike Pertzel / DATA 5 GmbH

If Outlook isn't running, GetObject will return Nothing. You need to handle
that scenario:

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

Also note that the method you're using is unsupported. It works from an
Outlook custom form, but I wouldn't necessarily expect it to work in other
code environments.
 
H

Heike Pertzel

Hallo Sue Mosher,

some time ago you answered this
See:
<http://groups.google.fi/groups?threadm=eSL8uKwWBHA.1748@tkmsftngp05>.
Quote (Sue Mosher):
" If the macro is in the built-in ThisOutlookSession module in
Outlook VBA, then you can invoke it as a method of the Outlook
Application object. However, this approach is not supported and
may not survive into the next version."

The next version doesn't concern us now. It should run now.
Can you help me again, please?

Thanks and regards
Heike Pertzel / DATA 5 GmbH


If Outlook isn't running, GetObject will return Nothing. You need to handle
that scenario:

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

Also note that the method you're using is unsupported. It works from an
Outlook custom form, but I wouldn't necessarily expect it to work in other
code environments.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top