View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default GetObject method not work after Call Shell Method

Ben might also look at the ErrorHandler in this, just in case even Shell
doesn't work

http://support.microsoft.com/?scid=kb;en-us;238610

Regards,
Peter T

"Tom Ogilvy" wrote in message
...
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