what is the full macro code? the objFolder is likely the cause of the problem.
Here is the entirety of the code:
Sub Email()
On Error Resume Next
Dim msg As MailItem
Dim i As Integer
Dim objFolder As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace
Dim objItem As Object
Dim Box As Integer
Set objNS = Application.GetNamespace("MAPI")
Set objFolder = objNS.Folders("GSC - DNB_Global Service Center").Folders("Inbox")
Set objItem = ActiveExplorer.Selection
'Assume this is a mail folder
'####change this to your Desktop#######
Const Path As String = "C:\Users\dastra\Downloads\Attachments\"
'######################################
i = 1
'delete any previous incarnation from this macro
If Dir(Path & "message.htm") <> "" Then
Kill Path & "message.htm"
Kill Path & "message_files\*.*"
End If
'save email as HTML to Path above
Set msg = ActiveExplorer.Selection.Item(1)
msg.SaveAs Path & "message.htm", olHTML
'if attachments exist, save them each in the message_files folder
If msg.Attachments.Count > 0 Then
While i <= msg.Attachments.Count
msg.Attachments.Item(i).SaveAsFile Path & "message_files\" & msg.Attachments.Item(i).FileName
i = i + 1
Wend
End If
'mark email as read
msg.UnRead = False
On Error GoTo EditHandler
Dim DateTime As String
Dim MyInput As String
Dim ToAdd As String
Dim StartBody As String
'#####change this to your initials#####
Const Initials As String = "DS"
'######################################
'get ticket number from user, date/time from system and add into single string
MyInput = InputBox("Enter I or R followed by ticket number")
DateTime = Now()
If MyInput = "" Then GoTo EditHandler
ToAdd = MyInput & " " & DateTime & " " & Initials
'prepend body of message with ticket/date/time/initials
StartBody = msg.HTMLBody
msg.HTMLBody = ToAdd & "<br><br><br>" & StartBody
On Error Resume Next
Box = InputBox("1 for Processed" & vbNewLine & "2 for No Ticket Required" & vbNewLine & "3 To Not Move this Email")
If Box = "1" Then objItem(1).Move objFolder.Folders("Processed")
If Box = "2" Then objItem(1).Move objFolder.Folders("No Ticket Required - E-Mail")
If Box = "3" Then MsgBox ("Your email will not be moved")
' Clean Up
Set msg = Nothing
Set objFolder = Nothing
Set objNS = Nothing
Set objItem = Nothing
Exit Sub
SaveHandler:
MsgBox ("Save as HTML Failed.")
Exit Sub
EditHandler:
MsgBox ("Save Successful, but failed to edit with ticket #.")
MoveHandler:
MsgBox ("Save and Edit Successful, but move failed")
End Sub
It will never error on that top code of :Set objFolder = objNS.Folders("GSC - DNB_Global Service Center").Folders("Inbox")
however if I do Set objFolder = objNS.Folders("GSC - DNB_Global Service Center").Folders("Inbox").Folders("Processed") sometimes it will work for 10-20 uses of the macro, sometimes it will work for 1 use of the macro before I need to restart Outlook.