How to extract date and time stamp from messsages

Status
Not open for further replies.
N

nitesh bansal

Hi

is it possible to write a macro that extracts the date and time stamp

of an incoming message coming in the inbox folder and save those

stamps in an excel sheet in separate columns with another column

adding the subject of the mail, and then finally move such message to

a specific folder.

Thanks in advance,
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Use the ItemAdd or NewMailEx events of the Inbox. If you want to get the

received time, read the ReceivedTime property.

Add a reference to the Excel library to your VBA project. Use the

Workbooks.Open function to get a workbook, then Sheets and Range to work

with sheets and cells. See the object browser (f2) for more details of

what's exposed by the object model. And press f1 for help.

Best regards

Michael Bauer

Am Thu, 20 Aug 2009 22:32:02 -0700 (PDT) schrieb nitesh bansal:


> Hi

> is it possible to write a macro that extracts the date and time stamp
> of an incoming message coming in the inbox folder and save those
> stamps in an excel sheet in separate columns with another column
> adding the subject of the mail, and then finally move such message to
> a specific folder.

> Thanks in advance,
 
N

nitesh bansal

On Aug 21, 9:45 am, "Michael Bauer " <m...@mvps.org
wrote:
> Use the ItemAdd or NewMailEx events of the Inbox. If you want to get the
> received time, read the ReceivedTime property.

> Add a reference to the Excel library to your VBA project. Use the
> Workbooks.Open function to get a workbook, then Sheets and Range to work
> with sheets and cells. See the object browser (f2) for more details of
> what's exposed by the object model. And press f1 for help.

> > Best regards
> Michael Bauer

> > > : <http://www.vboffice.net/product.html?pub=6〈=en
> Am Thu, 20 Aug 2009 22:32:02 -0700 (PDT) schrieb nitesh bansal:
>
> > Hi

>
> > is it possible to write a macro that extracts the date and time stamp
> > of an incoming message coming in the inbox folder and save those
> > stamps in an excel sheet in separate columns with another column
> > adding the subject of the mail, and then finally move such message to
> > a specific folder.

>
> > Thanks in advance,


Hi

I tried the following code

Sub TimeStampDigger()

Dim i%, myItem As Outlook.MailItem

Set myItem = Application.Session.GetDefaultFolder

(olFolderInbox).Items(1).Display

myTime = myItem.ReceivedTime

End Sub

The 2nd line of the code gives an error. I can't figure out how to set

mailItem as Item or Item as mailItem. I am completely confused about

this.

Kindly help.

Thanks,
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
It will work if you don't call the Display method as that doesn't return an

object.

Best regards

Michael Bauer

Am Mon, 24 Aug 2009 01:33:12 -0700 (PDT) schrieb nitesh bansal:


> On Aug 21, 9:45 am, "Michael Bauer " <m...@mvps.org
> wrote:
> > Use the ItemAdd or NewMailEx events of the Inbox. If you want to get the
> > received time, read the ReceivedTime property.
>

>> Add a reference to the Excel library to your VBA project. Use the
> > Workbooks.Open function to get a workbook, then Sheets and Range to work
> > with sheets and cells. See the object browser (f2) for more details of
> > what's exposed by the object model. And press f1 for help.
>

>> > > Best regards
> > Michael Bauer
>

>> >> >> : <http://www.vboffice.net/product.html?pub=6〈=en
>
>> Am Thu, 20 Aug 2009 22:32:02 -0700 (PDT) schrieb nitesh bansal:
> >
> >> Hi

> >
> >> is it possible to write a macro that extracts the date and time stamp
> >> of an incoming message coming in the inbox folder and save those
> >> stamps in an excel sheet in separate columns with another column
> >> adding the subject of the mail, and then finally move such message to
> >> a specific folder.

> >
> >> Thanks in advance,


> Hi

> I tried the following code

> Sub TimeStampDigger()

> Dim i%, myItem As Outlook.MailItem

> Set myItem = Application.Session.GetDefaultFolder
> (olFolderInbox).Items(1).Display

> myTime = myItem.ReceivedTime

> End Sub

> The 2nd line of the code gives an error. I can't figure out how to set
> mailItem as Item or Item as mailItem. I am completely confused about
> this.
> Kindly help.

> Thanks,
 
N

nitesh bansal

On Aug 24, 10:09 pm, "Michael Bauer " <m...@mvps.org
wrote:
> It will work if you don't call the Display method as that doesn't return an
> object.

> > Best regards
> Michael Bauer

> > > : <http://www.vboffice.net/product.html?pub=6〈=en
> Am Mon, 24 Aug 2009 01:33:12 -0700 (PDT) schrieb nitesh bansal:
>
> > On Aug 21, 9:45 am, "Michael Bauer " <m...@mvps.org
> > wrote:
> >> Use the ItemAdd or NewMailEx events of the Inbox. If you want to get the
> >> received time, read the ReceivedTime property.

>
> >> Add a reference to the Excel library to your VBA project. Use the
> >> Workbooks.Open function to get a workbook, then Sheets and Range to work
> >> with sheets and cells. See the object browser (f2) for more details of
> >> what's exposed by the object model. And press f1 for help.

>
> >> > >> Best regards
> >> Michael Bauer

>
> >> > >> > >> : <http://www.vboffice.net/product.html?pub=6〈=en>

>
> >> Am Thu, 20 Aug 2009 22:32:02 -0700 (PDT) schrieb nitesh bansal:

>
> >>> Hi

>
> >>> is it possible to write a macro that extracts the date and time stamp
> >>> of an incoming message coming in the inbox folder and save those
> >>> stamps in an excel sheet in separate columns with another column
> >>> adding the subject of the mail, and then finally move such message to
> >>> a specific folder.

>
> >>> Thanks in advance,

>
> > Hi

>
> > I tried the following code

>
> > Sub TimeStampDigger()

>
> > Dim i%, myItem As Outlook.MailItem

>
> > Set myItem = Application.Session.GetDefaultFolder
> > (olFolderInbox).Items(1).Display

>
> > myTime = myItem.ReceivedTime

>
> > End Sub

>
> > The 2nd line of the code gives an error. I can't figure out how to set
> > mailItem as Item or Item as mailItem. I am completely confused about
> > this.
> > Kindly help.

>
> > Thanks,


Hi

It worked perfectly.

Thanks.
 
N

nitesh bansal

On Aug 25, 12:01 pm, nitesh bansal <niteshbansa...@gmail.com> wrote:
> On Aug 24, 10:09 pm, "Michael Bauer " <m...@mvps.org
> wrote:

>
> > It will work if you don't call the Display method as that doesn't return an
> > object.

>
> > > > Best regards
> > Michael Bauer

>
> > > > > > : <http://www.vboffice.net/product.html?pub=6〈=en>

>
> > Am Mon, 24 Aug 2009 01:33:12 -0700 (PDT) schrieb nitesh bansal:

>
> > > On Aug 21, 9:45 am, "Michael Bauer " <m...@mvps.org
> > > wrote:
> > >> Use the ItemAdd or NewMailEx events of the Inbox. If you want to getthe
> > >> received time, read the ReceivedTime property.

>
> > >> Add a reference to the Excel library to your VBA project. Use the
> > >> Workbooks.Open function to get a workbook, then Sheets and Range to work
> > >> with sheets and cells. See the object browser (f2) for more details of
> > >> what's exposed by the object model. And press f1 for help.

>
> > >> > > >> Best regards
> > >> Michael Bauer

>
> > >> > > >> > > >> : <http://www.vboffice.net/product.html?pub=6〈=en>

>
> > >> Am Thu, 20 Aug 2009 22:32:02 -0700 (PDT) schrieb nitesh bansal:

>
> > >>> Hi

>
> > >>> is it possible to write a macro that extracts the date and time stamp
> > >>> of an incoming message coming in the inbox folder and save those
> > >>> stamps in an excel sheet in separate columns with another column
> > >>> adding the subject of the mail, and then finally move such message to
> > >>> a specific folder.

>
> > >>> Thanks in advance,

>
> > > Hi

>
> > > I tried the following code

>
> > > Sub TimeStampDigger()

>
> > > Dim i%, myItem As Outlook.MailItem

>
> > > Set myItem = Application.Session.GetDefaultFolder
> > > (olFolderInbox).Items(1).Display

>
> > > myTime = myItem.ReceivedTime

>
> > > End Sub

>
> > > The 2nd line of the code gives an error. I can't figure out how to set
> > > mailItem as Item or Item as mailItem. I am completely confused about
> > > this.
> > > Kindly help.

>
> > > Thanks,


> Hi

> It worked perfectly.

> Thanks.


But I have one more question.

How do I find using VBA whether an email message has an attachment or

not?

Thanks
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
See the item's Attachments collection. Very helpful for what properties are

exposed by what objects is the object browser: press f2, then switch from

<All Libraries> to Outlook.

Best regards

Michael Bauer

Am Tue, 25 Aug 2009 02:13:38 -0700 (PDT) schrieb nitesh bansal:


> On Aug 25, 12:01 pm, nitesh bansal <niteshbansa...@gmail.com> wrote:
> > On Aug 24, 10:09 pm, "Michael Bauer " <m...@mvps.org
>> wrote:
>

>
>>
> >> It will work if you don't call the Display method as that doesn't return


an
> >> object.

> >
> >> > >> Best regards
> >> Michael Bauer

> >
> >> >>> >>> : <http://www.vboffice.net/product.html?pub=6〈=en>

> >
> >> Am Mon, 24 Aug 2009 01:33:12 -0700 (PDT) schrieb nitesh bansal:

> >
> >> > On Aug 21, 9:45 am, "Michael Bauer " <m...@mvps.org
>>> > wrote:
> >> >> Use the ItemAdd or NewMailEx events of the Inbox. If you want to get


the
> >> >> received time, read the ReceivedTime property.

> >
> >> >> Add a reference to the Excel library to your VBA project. Use the
> >> >> Workbooks.Open function to get a workbook, then Sheets and Range to


work
> >> >> with sheets and cells. See the object browser (f2) for more details


of
> >> >> what's exposed by the object model. And press f1 for help.

> >
> >> >> > >> >> Best regards
> >> >> Michael Bauer

> >
> >> >> >>> >> >>> >> : <http://www.vboffice.net/product.html?pub=6〈=en>

> >
> >> >> Am Thu, 20 Aug 2009 22:32:02 -0700 (PDT) schrieb nitesh bansal:

> >
> >> >>> Hi

> >
> >> >>> is it possible to write a macro that extracts the date and time


stamp
> >> >>> of an incoming message coming in the inbox folder and save those
> >> >>> stamps in an excel sheet in separate columns with another column
> >> >>> adding the subject of the mail, and then finally move such message


to
> >> >>> a specific folder.

> >
> >> >>> Thanks in advance,

> >
> >> > Hi

> >
> >> > I tried the following code

> >
> >> > Sub TimeStampDigger()

> >
> >> > Dim i%, myItem As Outlook.MailItem

> >
> >> > Set myItem = Application.Session.GetDefaultFolder
> >> > (olFolderInbox).Items(1).Display

> >
> >> > myTime = myItem.ReceivedTime

> >
> >> > End Sub

> >
> >> > The 2nd line of the code gives an error. I can't figure out how to set
> >> > mailItem as Item or Item as mailItem. I am completely confused about
> >> > this.
> >> > Kindly help.

> >
> >> > Thanks,

>

>> Hi
>

>> It worked perfectly.
>

>> Thanks.


> But I have one more question.

> How do I find using VBA whether an email message has an attachment or
> not?

> Thanks
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
N Extract Outlook emails to excel Outlook VBA and Custom Forms 2
M Extract all links from Outlook email, send to Excel Using Outlook 2
T Extract Data From Outlook Tasks Using Outlook 0
T Extract Data From Outlook Tasks Using Outlook 0
V extract users of a particular department Outlook VBA and Custom Forms 1
J Outlook 2013 Extract Flag Completed dates to Excel Macro Outlook VBA and Custom Forms 16
S How to extract mail items from multiple folders and shared mailboxes? Outlook VBA and Custom Forms 0
K Extract email address from body and auto-reply outlook Using Outlook 1
R Trying to extract information between two symbols from outlook subject Using Outlook 2
K Extract email to excel from a specific sender Outlook VBA and Custom Forms 3
O VBA to extract email (fields and body) to Excel Outlook VBA and Custom Forms 14
P Recover / Extract Rules from standalone PST file creating RWZ file Using Outlook 2
B Extract Dates for Appointment Item in Body of email Outlook VBA and Custom Forms 10
D Need to extract a line from a word attachment, and add it to the subject line Outlook VBA and Custom Forms 3
E Extract excel files from outlook Outlook VBA and Custom Forms 2
K extract certain text from an Outlook Email Message Outlook VBA and Custom Forms 2
D VBA Script to extract text matching specific criteria Outlook VBA and Custom Forms 1
M Extract text in existing message body for use in newmail items Using Outlook 17
M HELP--Extract Data from 2003 outlook transfer to excel spreadsheet Using Outlook 1
M VBA Code to extract data from an Outlook Form Using Outlook 0
M Extract attachments with a script Using Outlook 0
M HELP - Can't open outlook... How can I extract my Emails that I had in folders Using Outlook 3
H Extract emails from Outlokk 2007 email body Using Outlook 0
K Extract Global Address List Using Outlook 1
E I am trying to extract the email adress's i have in outlook. These are not saved 'contacts' these are ones from auto fill. When i open up an email, an Using Outlook 1
L How to extract table format of Task Item if its body contains formatted table. Exchange Server Administration 1
D Extract email addresses from inbox in a batch and move them into "bcc" for a mass email campaign Using Outlook 1
M Extract, zip and replace attachement in each message of a pst file Using Outlook 0
R Saving Outlook Email As Text File Extract Outlook VBA and Custom Forms 2
N Programming to extract automatically extract attachments Outlook VBA and Custom Forms 3
S How to extract outlook calendar data. Outlook VBA and Custom Forms 3
? outlook attachment Extract File ??? Outlook VBA and Custom Forms 1
D Extract Data from OST File Using Outlook 2
V Extract Subject,Sent From, Message from mailbox to Excel Outlook VBA and Custom Forms 5
S Automatically extract attachments? Outlook VBA and Custom Forms 1
I How to extract email addresses from TO or CC line of a particular email Outlook VBA and Custom Forms 2
V Date and/or time error in Outlook Form Outlook VBA and Custom Forms 0
S Body text of Email from invite date/time Outlook VBA and Custom Forms 8
V 10 Years calenders -single date together Exchange Server Administration 8
O Export Outlook calendar appointments by filters and date range Outlook VBA and Custom Forms 1
D Add date next to day name in Outlook Today calendar view Using Outlook 1
X If you change expiration date of repeated task it dupplicates Using Outlook 1
D Archive by receive date not working Using Outlook 2
V Making a Date field mandatory in outlook form Outlook VBA and Custom Forms 2
P Auto Insert Current Date or Time into Email Subject Outlook VBA and Custom Forms 2
L Ctrl Alt d date stamp use Using Outlook 1
A Create date folder and move messages daily Outlook VBA and Custom Forms 1
witzker Outlook 2010 Insert Date & Time at the button of an OL contactform in red Using Outlook 2
O Tasks - Is there a postponed date column? Using Outlook 7
J Command Button to stamp a date and time in a textbox in Outlook 2016 Outlook VBA and Custom Forms 3
Similar threads


















































Top