Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Modified Date lookup

I have a .rtf documents that may or may not be updated daily. If it was
updated today then it needs to be added to an email to be sent out. If not,
the .rft document is not sent. Is there code i can put in excel that will
look at the modified date for a specific file, check to see if that file date
equals todays, and if it does, attack it to an email.

Here is the code i currently use for the email:

Sub Mail_workbook_Outlook()

Windows("CSTS Rollup.xls").Activate

Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "Distro"
.CC = ""
.BCC = ""
.Subject = "Daily/MTD CSTS Rollup as of " & Format(Date, "mm_dd_yy")
.Body = ""
.Attachments.Add ActiveWorkbook.FullName
.Display
.ReadReceiptRequested = False
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing

ActiveWindow.Close

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Modified Date lookup

Excel changes the modified date to wheneve the file was opened, so if that's
an issue, you may want something else.

Otherwise:

If DateValue(FileDateTime("C\File.xls")) = DateValue(Now()) Then
MsgBox "today"
Else
MsgBox "not today"
End If



"Greg H." wrote in message
...
I have a .rtf documents that may or may not be updated daily. If it was
updated today then it needs to be added to an email to be sent out. If
not,
the .rft document is not sent. Is there code i can put in excel that will
look at the modified date for a specific file, check to see if that file
date
equals todays, and if it does, attack it to an email.

Here is the code i currently use for the email:

Sub Mail_workbook_Outlook()

Windows("CSTS Rollup.xls").Activate

Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "Distro"
.CC = ""
.BCC = ""
.Subject = "Daily/MTD CSTS Rollup as of " & Format(Date,
"mm_dd_yy")
.Body = ""
.Attachments.Add ActiveWorkbook.FullName
.Display
.ReadReceiptRequested = False
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing

ActiveWindow.Close

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Modified Date lookup

Sorry, must not have been clear. I want to look at the modified date of the
..rtf file, not the excel file. If the .rtf file was updated today, attach
it. If it was not modified today, dont attach it.

"-" wrote:

Excel changes the modified date to wheneve the file was opened, so if that's
an issue, you may want something else.

Otherwise:

If DateValue(FileDateTime("C\File.xls")) = DateValue(Now()) Then
MsgBox "today"
Else
MsgBox "not today"
End If



"Greg H." wrote in message
...
I have a .rtf documents that may or may not be updated daily. If it was
updated today then it needs to be added to an email to be sent out. If
not,
the .rft document is not sent. Is there code i can put in excel that will
look at the modified date for a specific file, check to see if that file
date
equals todays, and if it does, attack it to an email.

Here is the code i currently use for the email:

Sub Mail_workbook_Outlook()

Windows("CSTS Rollup.xls").Activate

Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "Distro"
.CC = ""
.BCC = ""
.Subject = "Daily/MTD CSTS Rollup as of " & Format(Date,
"mm_dd_yy")
.Body = ""
.Attachments.Add ActiveWorkbook.FullName
.Display
.ReadReceiptRequested = False
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing

ActiveWindow.Close

End Sub




  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Modified Date lookup

Same principle. This will work for any file. Just replace the "sample" file
I posted with yours. It doesn't matter if it's an rtf file. For more info
see FileDateTime in the help files.


"Greg H." wrote in message
...
Sorry, must not have been clear. I want to look at the modified date of
the
.rtf file, not the excel file. If the .rtf file was updated today, attach
it. If it was not modified today, dont attach it.

"-" wrote:

Excel changes the modified date to wheneve the file was opened, so if
that's
an issue, you may want something else.

Otherwise:

If DateValue(FileDateTime("C\File.xls")) = DateValue(Now()) Then
MsgBox "today"
Else
MsgBox "not today"
End If



"Greg H." wrote in message
...
I have a .rtf documents that may or may not be updated daily. If it was
updated today then it needs to be added to an email to be sent out. If
not,
the .rft document is not sent. Is there code i can put in excel that
will
look at the modified date for a specific file, check to see if that
file
date
equals todays, and if it does, attack it to an email.

Here is the code i currently use for the email:

Sub Mail_workbook_Outlook()

Windows("CSTS Rollup.xls").Activate

Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "Distro"
.CC = ""
.BCC = ""
.Subject = "Daily/MTD CSTS Rollup as of " & Format(Date,
"mm_dd_yy")
.Body = ""
.Attachments.Add ActiveWorkbook.FullName
.Display
.ReadReceiptRequested = False
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing

ActiveWindow.Close

End Sub






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
Last Modified Date Me Excel Programming 2 May 23rd 07 04:19 PM
Date Last Modified Emma Hope Excel Worksheet Functions 3 July 19th 06 09:06 PM
Last Modified Date help... vmadan16 Excel Programming 0 June 22nd 06 12:40 PM
modified date ceemo[_41_] Excel Programming 1 October 29th 05 06:20 PM
Modified Date DME New Users to Excel 11 December 14th 04 07:15 PM


All times are GMT +1. The time now is 09:23 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"