J
John
Hi
I have the below code to reply to an email with a standard template. The
problem is that it is not working on outlook xp which is connected to an
exchange 2003. Basically nothing happens on these three lines;
Set Item = objApp.CreateItemFromTemplate("f:\EspritStaff.oft")
Item.To = objItem.SenderEmailAddress
Item.Display (False)
I have run this code on a standalone outlook 2003 and it works fine. What is
wrong and how can I fix it?
Thanks
Regards
Sub ReplySpecial()
Dim objApp As Application
Dim objSel As Selection
Dim objItem As Object
Dim Item As MailItem
Set objApp = CreateObject("Outlook.Application")
Select Case objApp.ActiveWindow.Class
Case olExplorer
Set objSel = objApp.ActiveExplorer.Selection
If objSel.Count > 0 Then
Set objItem = objSel.Item(1)
End If
Case olInspector
Set objItem = objApp.ActiveInspector.CurrentItem
Case Else
' can't handle any other kind of window
End Select
If objItem.Class = olMail Then
' MsgBox objItem.SenderEmailAddress
Set Item = objApp.CreateItemFromTemplate("c:\Esprit Staff
Information.oft")
Item.To = objItem.SenderEmailAddress
Item.Display (False)
Else
MsgBox "This is not an email. Please select an email.", vbInformation
+ vbOKOnly, "Reply"
End If
Set objItem = Nothing
Set objSel = Nothing
Set objApp = Nothing
End Sub
I have the below code to reply to an email with a standard template. The
problem is that it is not working on outlook xp which is connected to an
exchange 2003. Basically nothing happens on these three lines;
Set Item = objApp.CreateItemFromTemplate("f:\EspritStaff.oft")
Item.To = objItem.SenderEmailAddress
Item.Display (False)
I have run this code on a standalone outlook 2003 and it works fine. What is
wrong and how can I fix it?
Thanks
Regards
Sub ReplySpecial()
Dim objApp As Application
Dim objSel As Selection
Dim objItem As Object
Dim Item As MailItem
Set objApp = CreateObject("Outlook.Application")
Select Case objApp.ActiveWindow.Class
Case olExplorer
Set objSel = objApp.ActiveExplorer.Selection
If objSel.Count > 0 Then
Set objItem = objSel.Item(1)
End If
Case olInspector
Set objItem = objApp.ActiveInspector.CurrentItem
Case Else
' can't handle any other kind of window
End Select
If objItem.Class = olMail Then
' MsgBox objItem.SenderEmailAddress
Set Item = objApp.CreateItemFromTemplate("c:\Esprit Staff
Information.oft")
Item.To = objItem.SenderEmailAddress
Item.Display (False)
Else
MsgBox "This is not an email. Please select an email.", vbInformation
+ vbOKOnly, "Reply"
End If
Set objItem = Nothing
Set objSel = Nothing
Set objApp = Nothing
End Sub