View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default GetObject method not work after Call Shell Method

Guess you missed where he said createobject for Outlook had been disabled by
Microsoft:

I can not use CreateObject for the last service pack microsoft released
killed that function for outlook.


--
Regards,
Tom Ogilvy


"keepITcool" wrote in message
.com...

no need to shell, and no need for doevents.
i think Tom's code is missing the CreateObject call.

Iso using a module level object variable I've wrapped it in a
STATIC function, so it can be easily called troughout your other code.

Option Explicit

Static Function olApp() As Object
Dim oApp As Object

If oApp Is Nothing Then
On Error Resume Next
Set oApp = GetObject(, "Outlook.Application")
On Error GoTo 0
If oApp Is Nothing Then
Set oApp = CreateObject("Outlook.Application")
End If
End If
Set olApp = oApp
End Function

Sub foo()
With olApp
.GetNamespace("MAPI").GetDefaultFolder(6).Display
End With
End Sub



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


ben wrote in

didn't do quite what i expected but doevents definitely changed
things up a bit. I think I can work through it now.
Thanks again Tom