- Subject: Re: 2003 Code throws error in 2007 - CreateObject
- Author: Jeff Popova-Clark
- Date: 20 Dec 2007
- References:
1
My IT crowd couldn't find a problem, but I'll tell you how I got around it:
I used the following code instead:
Sub Open_SaveItem()
Dim objApp As Outlook.Explorer
Dim objSelItem As Object
Dim objSelection As Outlook.Selection
Dim strSubject As String
Dim dteDate As Date
Dim dteTime As Date
Set objApp = Application.ActiveExplorer
Set objSelection = objApp.Selection
SaveAsFile.Show
Set objApp = Nothing
Set objSelItem = Nothing
Set objSelection = Nothing
End Sub
Note that the only three changed lines are:
Dim objApp As Outlook.Explorer
Set objApp = Application.ActiveExplorer
Set objSelection = objApp.Selection
Which were:
Dim objApp As Outlook.Application
Set objApp = CreateObject("Outlook.Application")
Set objSelection = objApp.ActiveExplorer.Selection
I think this means that the code is using the current Outlook app as default.
I hope this helps someone!
Regards,
Jeff Popova-Clark
Gold Coast, Australia