Prompt before sending contacts to Deleted Items folder

Status
Not open for further replies.

infotech

Member
Is there a way to enable a prompt when attempting to delete a contact? At the current time, if I delete a contact, it zips away to the Deleted Items folder with no prompt. It is essential that a prompt is displayed before deleting the files. This is for the CEO of the company I work for. He wants to avoid any chance of deleting business contacts by accident. Whether there is a setting for this or some sort of macro, as long as the issue is resolved, he will be happy and so will I. Thank you for any help you may be able to offer.




Note: Even if there is a macro that displays a message after the contact is sent to the deleted items folder and then either moves it back to the origin or leaves it to rot would work. Unfotunately, I have no experience with writing macros :/
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Outlook doesn't offer an 'are you sure' prompt, but you can prompt with VBA. You'll use something like this (but i didn't test it yet to verify it works):


Private Sub Application_BeforeDelete(ByVal Item As Object, Cancel As Boolean)


'Prompts the user before deleting an item


Dim strPrompt As String


'Prompt the user for a response


strPrompt = "Are you sure you want to delete the item?"


If MsgBox(strPrompt, vbYesNo + vbQuestion) = vbNo Then


'Don't delete the item


Cancel = True


End If


End Sub
 

infotech

Member
Thank you for the response! Is there a way to make this macro run when someone deletes a contact from just the Shared Contacts folder? I'm new to macros so I really have no idea if this code will work under our circumstances. Thanks again!

Outlook doesn't offer an 'are you sure' prompt, but you can prompt with VBA. You'll use something like this (but i didn't test it yet to verify it works):

Private Sub Application_BeforeDelete(ByVal Item As Object, Cancel As Boolean)
'Prompts the user before deleting an item
Dim strPrompt As String
'Prompt the user for a response
strPrompt = "Are you sure you want to delete the item?"
If MsgBox(strPrompt, vbYesNo + vbQuestion) = vbNo Then
'Don't delete the item
Cancel = True
End If

End Sub
 

catherized

Senior Member
Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server 2010
I don't think so, but either this macro isn't quite right or it doesn't work in Outlook 2010.




Is the shared folder a public folder or a contacts folder from someone else's mailbox? You could configure permissions so people can only delete contacts they added or not delete any.
 

infotech

Member
I managed to get the code working with some modifications:

Sub delete()

Dim Cancel As Boolean

Dim strPrompt As String

'Prompt the user for a response

strPrompt = "Are you sure you want to delete the item(s)?"

If MsgBox(strPrompt, vbYesNo + vbQuestion) = vbNo Then

SendKeys ("^z")

'Don't delete the item

Cancel = True

End If

End Sub

I would like to find a way to get this to work now when you actually attempt to delete a contact. It can be in any of the contact folders for that matter. We just need this prompt setup to run when a file is deleted...Hopefully this is possible.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I haven't tried your code yet, but it should only work when you use the delete command on an open message, not with the delete key or delete command when viewing in the contacts folder.
 

infotech

Member
That's correct. I would really like to get it working for the entire folder though. Is that possible? Also, what has to be done for the macro to run from the time Outlook opens? Sorry if these questions are elementary. I have tried Googling and there's an overwhelming amount of results, mostly irrelevant to my queries...Thanks for any help you may offer!




I haven't tried your code yet, but it should only work when you use the delete command on an open message, not with the delete key or delete command when viewing in the contacts folder.
 
Status
Not open for further replies.
Top