- Subject: 2003 Code throws error in 2007 - CreateObject
- Author: Jeff Popova-Clark
- Date: 02 Nov 2007
- References:
Hello Outlook gurus,
I have some simple code which launches a form for saving emails to file. it works fairly well in Outlook 2003, but throws an error in Outlook 2007. Anyone know why and how to fix it?
Sub Open_SaveItem()
Dim objApp As Outlook.Application
Dim objSelItem As Object
Dim objSelection As Outlook.Selection
Dim strSubject As String
Dim dteDate As Date
Dim dteTime As Date
Set objApp = CreateObject("Outlook.Application")
Set objSelection = objApp.ActiveExplorer.Selection
SaveAsFile.Show
Set objApp = Nothing
Set objSelItem = Nothing
Set objSelection = Nothing
End Sub
The offending line is:
Set objApp = CreateObject("Outlook.Application")
I have the following object libraries referenced:
Outlook 12.0
Office 12.0
VBA
Word 12.0
Forms 12.0
Thanx in advance,
Jeff Popova-Clark
Gold Coast, Australia