Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Timestamp from Outlook

Hi. Every week I run a procedure that saves the attachments from a bunch of
e-mails with a single folder to 1 large file. My question is this - can I
somehow also, for each file, pull in the timestamp from when the e-mail was
received??


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Timestamp from Outlook

Steph

Use the ReceivedTime property of the MailItem object.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Steph" wrote in message
...
Hi. Every week I run a procedure that saves the attachments from a bunch

of
e-mails with a single folder to 1 large file. My question is this - can I
somehow also, for each file, pull in the timestamp from when the e-mail

was
received??




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Timestamp from Outlook

Thanks Dick. Do you know of any sample syntax?

"Dick Kusleika" wrote in message
...
Steph

Use the ReceivedTime property of the MailItem object.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Steph" wrote in message
...
Hi. Every week I run a procedure that saves the attachments from a

bunch
of
e-mails with a single folder to 1 large file. My question is this - can

I
somehow also, for each file, pull in the timestamp from when the e-mail

was
received??






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Timestamp from Outlook

As a matter of fact I do. I should have included that in my answer, sorry
about that.

http://www.dicks-clicks.com/excel/olRetrieving.htm

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Jack" wrote in message
...
Thanks Dick. Do you know of any sample syntax?

"Dick Kusleika" wrote in message
...
Steph

Use the ReceivedTime property of the MailItem object.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Steph" wrote in message
...
Hi. Every week I run a procedure that saves the attachments from a

bunch
of
e-mails with a single folder to 1 large file. My question is this -

can
I
somehow also, for each file, pull in the timestamp from when the

e-mail
was
received??








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Timestamp from Outlook

Thanks Dick. I checked it out, but admit I'm real good at this stuff.
Recall that my procedure saves all attachments to a specific folder (not an
outlook folder). I have a counter in place and am renaming the files
arbitrarily based on that. Would it be easy to save the filename as the
ReceivedTime? I guess the one pre-req I should have asked is Can 2 e-mails
arrive at the exact same time, and therefore have the exact same
ReceivedTime?

Thanks Dick!!!!!!!!!!!!!!
"Dick Kusleika" wrote in message
...
As a matter of fact I do. I should have included that in my answer, sorry
about that.

http://www.dicks-clicks.com/excel/olRetrieving.htm

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Jack" wrote in message
...
Thanks Dick. Do you know of any sample syntax?

"Dick Kusleika" wrote in
message
...
Steph

Use the ReceivedTime property of the MailItem object.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Steph" wrote in message
...
Hi. Every week I run a procedure that saves the attachments from a

bunch
of
e-mails with a single folder to 1 large file. My question is this -

can
I
somehow also, for each file, pull in the timestamp from when the

e-mail
was
received??












  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Timestamp from Outlook

Sorry Dick, my previous post shoud have read But I admit I'm NOT real good
at this stuff!!!!!! Stressing the word NOT!!
Sorry....that typo made me sound like a know-it-all pompous ass!!
"Steph" wrote in message
...
Thanks Dick. I checked it out, but admit I'm real good at this stuff.
Recall that my procedure saves all attachments to a specific folder (not
an outlook folder). I have a counter in place and am renaming the files
arbitrarily based on that. Would it be easy to save the filename as the
ReceivedTime? I guess the one pre-req I should have asked is Can 2
e-mails arrive at the exact same time, and therefore have the exact same
ReceivedTime?

Thanks Dick!!!!!!!!!!!!!!
"Dick Kusleika" wrote in message
...
As a matter of fact I do. I should have included that in my answer,
sorry
about that.

http://www.dicks-clicks.com/excel/olRetrieving.htm

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Jack" wrote in message
...
Thanks Dick. Do you know of any sample syntax?

"Dick Kusleika" wrote in
message
...
Steph

Use the ReceivedTime property of the MailItem object.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Steph" wrote in message
...
Hi. Every week I run a procedure that saves the attachments from a
bunch
of
e-mails with a single folder to 1 large file. My question is this -

can
I
somehow also, for each file, pull in the timestamp from when the

e-mail
was
received??












  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Timestamp from Outlook

Steph

Yes, you can have two emails with same received time. Of the 1,406 emails
in my Junk folder, two pair had the exact same received time. That's pretty
low odds, but I don't know if it's worth it. If you'd like to use the
ReceivedTime for other reasons, then you could pretty easily append a number
to the end of the file name if it already exists.

Each message has a unique ID, but it's like 27 characters long and pretty
unintelligible. Let me know if you need more help with any of these
options.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Steph" wrote in message
...
Sorry Dick, my previous post shoud have read But I admit I'm NOT real good
at this stuff!!!!!! Stressing the word NOT!!
Sorry....that typo made me sound like a know-it-all pompous ass!!
"Steph" wrote in message
...
Thanks Dick. I checked it out, but admit I'm real good at this stuff.
Recall that my procedure saves all attachments to a specific folder (not
an outlook folder). I have a counter in place and am renaming the files
arbitrarily based on that. Would it be easy to save the filename as the
ReceivedTime? I guess the one pre-req I should have asked is Can 2
e-mails arrive at the exact same time, and therefore have the exact same
ReceivedTime?

Thanks Dick!!!!!!!!!!!!!!
"Dick Kusleika" wrote in

message
...
As a matter of fact I do. I should have included that in my answer,
sorry
about that.

http://www.dicks-clicks.com/excel/olRetrieving.htm

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Jack" wrote in message
...
Thanks Dick. Do you know of any sample syntax?

"Dick Kusleika" wrote in
message
...
Steph

Use the ReceivedTime property of the MailItem object.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Steph" wrote in message
...
Hi. Every week I run a procedure that saves the attachments from

a
bunch
of
e-mails with a single folder to 1 large file. My question is

this -
can
I
somehow also, for each file, pull in the timestamp from when the
e-mail
was
received??














  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Timestamp from Outlook

Hi Dick,

Wow, so it is possible that 2 emails arrive at the same time. The reason
I'd like to use it is this - we are having contractors send in their
timesheets via e-mail (roughly 300) each week. I'm sure the following will
happen - someone sends in their timesheet, then later realized they screwed
up, and therefore they'll resend. My current code grabs all attachments and
consolidates then onto one sheet for Supervisor approval. In the previous
example, someone will have 2 submittions. I wanted to use the timestamp to
help the Supervisors choose which one to reject and which one to approve.
(the assumption being the last one received is the one to use).

But I guess the possibility exists that of the 300 e-mails coming in each
week, 2 do show up at the exact same time.

So that being said, and my ignorance for this level of coding, can you help
me? The appendage to the end of the time would be nice if 2 e-mails arrive
at the same time. So is it easy to append my code to save the file name as
the ReceivedTime (plus possibly the end # appendage)??

Thanks Dick!!

"Dick Kusleika" wrote in message
...
Steph

Yes, you can have two emails with same received time. Of the 1,406 emails
in my Junk folder, two pair had the exact same received time. That's
pretty
low odds, but I don't know if it's worth it. If you'd like to use the
ReceivedTime for other reasons, then you could pretty easily append a
number
to the end of the file name if it already exists.

Each message has a unique ID, but it's like 27 characters long and pretty
unintelligible. Let me know if you need more help with any of these
options.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Steph" wrote in message
...
Sorry Dick, my previous post shoud have read But I admit I'm NOT real
good
at this stuff!!!!!! Stressing the word NOT!!
Sorry....that typo made me sound like a know-it-all pompous ass!!
"Steph" wrote in message
...
Thanks Dick. I checked it out, but admit I'm real good at this stuff.
Recall that my procedure saves all attachments to a specific folder
(not
an outlook folder). I have a counter in place and am renaming the
files
arbitrarily based on that. Would it be easy to save the filename as
the
ReceivedTime? I guess the one pre-req I should have asked is Can 2
e-mails arrive at the exact same time, and therefore have the exact
same
ReceivedTime?

Thanks Dick!!!!!!!!!!!!!!
"Dick Kusleika" wrote in

message
...
As a matter of fact I do. I should have included that in my answer,
sorry
about that.

http://www.dicks-clicks.com/excel/olRetrieving.htm

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Jack" wrote in message
...
Thanks Dick. Do you know of any sample syntax?

"Dick Kusleika" wrote in
message
...
Steph

Use the ReceivedTime property of the MailItem object.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Steph" wrote in message
...
Hi. Every week I run a procedure that saves the attachments from

a
bunch
of
e-mails with a single folder to 1 large file. My question is

this -
can
I
somehow also, for each file, pull in the timestamp from when the
e-mail
was
received??
















  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Timestamp from Outlook

Steph

So that being said, and my ignorance for this level of coding, can you

help
me? The appendage to the end of the time would be nice if 2 e-mails

arrive
at the same time. So is it easy to append my code to save the file name

as
the ReceivedTime (plus possibly the end # appendage)??


Once you've identified an email with an attachment to save, try something
like this

lUnique = 1
Do
sFname = Format(mi.ReceivedTime, "yyyymmddhhmmss") & lUnique &
".xls"
lUnique = lUnique + 1
Loop Until Len(Dir(sPath & sFname)) = 0

mi.Attachments(1).SaveAsFile sPath & sFname


where mi is MailItem variable. This loops adding a larger number to the end
of the proposed filename until it comes upon a file name that doesn't exist.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
timestamp james Excel Worksheet Functions 2 May 17th 09 06:16 PM
Timestamp juanpablo Excel Discussion (Misc queries) 3 November 2nd 07 01:55 PM
Timestamp Sher Excel Discussion (Misc queries) 2 November 3rd 06 04:31 PM
Now as timestamp Lp12 Excel Worksheet Functions 5 August 13th 06 11:32 AM
timestamp tommyboy[_3_] Excel Programming 6 July 7th 04 10:19 AM


All times are GMT +1. The time now is 04:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"