# Outlook auto reply with a reference number



## ADAMC (Feb 6, 2009)

Hi all

My question is related to Microsoft outlook.
I have a folder set up called CRF_responses.....
Someone goes online and basically fills out an order form which in turn sends all the data from that form to the folder above in my inbox. what i want to do is set up an auto reply....easily down with a simple rule, however what i am hoping i can achieve in VBA is add macro to the folder to say:

When an email arrives, auto respond to it and in the subject field create a reference number but this reference number will need to be uniqiue each time.

The subject line would be: 000/001---------THEN 000/002 an so on.

Anyone know if im barking up the wrong tree here or whether its even possible? If it helps the subject for the email coming IN to me is always NEW CRF im thinking this is a way of capturing when to auto reply with a reference number.

Thanks!


----------



## JP2112 (Feb 10, 2009)

Someone asked a similar question on vbaexpress.com recently, here was my response:

Write a macro that writes a number to a text file on your hard drive whenever a new message is received. First, it would need to open the file, read the value, close the file, increase it by one, then recreate the file with the new value.

Check out the Application_NewMail or Items_ItemAdd Event, which fires every time a new message is received or a new item is added to a specific folder.

This code can be adapted for your purpose:

Event Code for Forwarding Selected Text to Another Email Address

(Original: http://www.vbaexpress.com/forum/showthread.php?t=25005)

HTH




ADAMC said:


> Hi all
> 
> My question is related to Microsoft outlook.
> I have a folder set up called CRF_responses.....
> ...


----------

