D
Dan
Hi there,
i have a very simple macro partially from Sue Mosher's book. The purpose of
it is to set a customized reminder on a selected mailitem. I have a button
on the toolbar firing this macro (MySetReminder()). This worked fine for
more than a week. But now it suddenly creates a VBA error: Run-time error
'-2147221241 (80040107)': Method 'FlagDueBy' of 'MailItem'failed.
The script is below. i can't recall having changed anyhing. And now i am
puzzled why it suddenly stopped working.. Any pointers are very much
appreciated.
Thanks
Daniel
Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = CreateObject("Outlook.Application")
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
Case Else
' anything else will result in an error, which is
' why we have the error handler above
End Select
Set objApp = Nothing
End Function
Sub MySetReminder()
Set objItem = GetCurrentItem()
With objItem
.FlagDueBy = Date + 10 ' here it
fails !!!
.FlagRequest = "Check what has happened"
.FlagIcon = 4
.FlagStatus = olFlagMarked
.Save
End With
End Sub
i have a very simple macro partially from Sue Mosher's book. The purpose of
it is to set a customized reminder on a selected mailitem. I have a button
on the toolbar firing this macro (MySetReminder()). This worked fine for
more than a week. But now it suddenly creates a VBA error: Run-time error
'-2147221241 (80040107)': Method 'FlagDueBy' of 'MailItem'failed.
The script is below. i can't recall having changed anyhing. And now i am
puzzled why it suddenly stopped working.. Any pointers are very much
appreciated.
Thanks
Daniel
Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = CreateObject("Outlook.Application")
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
Case Else
' anything else will result in an error, which is
' why we have the error handler above
End Select
Set objApp = Nothing
End Function
Sub MySetReminder()
Set objItem = GetCurrentItem()
With objItem
.FlagDueBy = Date + 10 ' here it
fails !!!
.FlagRequest = "Check what has happened"
.FlagIcon = 4
.FlagStatus = olFlagMarked
.Save
End With
End Sub