Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / March 2008

Tip: Looking for answers? Try searching our database.

error popup coming unnecessarily

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dickery1 - 06 Mar 2008 11:03 GMT
Hello
I have a fully working code but for some reason it still triggers the
err block. can someone tell me why. I get a msgbox with Error 0 in it.
i thoght that they get triggered only if there is a error.

Sub MovePastDate2Today()
   On Error GoTo MovePastDate2Today_Error
   Dim t As TaskItem
   Set f =
Application.GetNamespace("MAPI").GetDefaultFolder(olFolderTasks)
   strText = ""
   For Each t In f.Items
       If (t.DueDate < Date And Not (t.Status = olTaskComplete)) Then
           'strText = strText & (t.DueDate) & "  "
           t.DueDate = Date
           t.Save

       End If
   Next

    'MsgBox strText
   'MsgBox Date

MovePastDate2Today_Error:
   MsgBox "Error " & Err.Number & "(" & Err.Description & ")"

End Sub
Sue Mosher [MVP-Outlook] - 06 Mar 2008 13:57 GMT
Either put an Exit Sub statement before the Error: block or put the MsgBox inside an If Err <> 0 ... End If block. Code execution is going right through your Error: block.

Signature

Sue Mosher, Outlook MVP
  Author of Microsoft Outlook 2007 Programming:
    Jumpstart for Power Users and Administrators
   http://www.outlookcode.com/article.aspx?id=54

> Hello
> I have a fully working code but for some reason it still triggers the
[quoted text clipped - 23 lines]
>
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.