Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default Help on coding please?

Does anyone have any suggestions on how to perform following tasks in macro?
I would like to check the last updated for the file ABC.xls, if the last
updated is today after 10am, then perform macro, else skip running the rest
of coding.
Does anyone have any suggestions?
Thank you in advance for any suggestions
Eric
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help on coding please?

Note that I am indicating the file's path be provided along with its name...

If FileDateTime("c:\FilesPath\ABC.xls") Date + TimeSerial(10, 0, 0) Then
' The file's last modified date is later than 10am today
End If

The FileDateTime function is a built-in function in VBA which returns the
last modified date for the PathFileName passed into it as an argument.

Rick


"Eric" wrote in message
...
Does anyone have any suggestions on how to perform following tasks in
macro?
I would like to check the last updated for the file ABC.xls, if the last
updated is today after 10am, then perform macro, else skip running the
rest
of coding.
Does anyone have any suggestions?
Thank you in advance for any suggestions
Eric


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default Help on coding please?

Thank you very much for your suggestions

What if I would like to create a loop on monitoiring the file ABC.xls
status, anytime if the file ABC.xls is updated after 10am of today, then
perform the macro, else skip and wait.
Do you have any suggestions?
Thank you very much for any suggestions
Eric

"Rick Rothstein (MVP - VB)" wrote:

Note that I am indicating the file's path be provided along with its name...

If FileDateTime("c:\FilesPath\ABC.xls") Date + TimeSerial(10, 0, 0) Then
' The file's last modified date is later than 10am today
End If

The FileDateTime function is a built-in function in VBA which returns the
last modified date for the PathFileName passed into it as an argument.

Rick


"Eric" wrote in message
...
Does anyone have any suggestions on how to perform following tasks in
macro?
I would like to check the last updated for the file ABC.xls, if the last
updated is today after 10am, then perform macro, else skip running the
rest
of coding.
Does anyone have any suggestions?
Thank you in advance for any suggestions
Eric



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help on coding please?

You could try this. Go into the VBA editor and add a Module to your project.
Copy/Paste this code into its code window...

Sub CheckFile()
Const PathFileName As String = "c:\FilesPath\ABC.xls"
If FileDateTime(PathFileName) Date + TimeSerial(10, 0, 0) Then
'
' Either put the code you want to run here or call
' a subroutine that has the code you want to run
'
MsgBox "Updating complete"
Else
Application.OnTime Now + TimeSerial(0, 0, 30), "CheckFile"
End If
End Sub

Now, double click the ThisWorkbook item in the Project Explorer window and
add this code to its code window...

Private Sub Workbook_Open()
CheckFile
End Sub

or, if you already have Workbook_Open event code, add the call to CheckFile
at the end of your code.

NOTES
=========
1) Change the PathFileName constant to point to the path and filename that
you want to check.

2) In the CheckFile subroutine, I have TimeSerial(0, 0, 30) being added to
the Now function. This adds 30 seconds to the value of Now. The purpose for
the entire statement this code is in is to set the timer to call CheckFile
over and over again (as long as the file has not been updated) every 30
seconds. Change the TimeSerial(0, 0, 30) values to whatever repeat time
value you want to use.

Rick



"Eric" wrote in message
...
Thank you very much for your suggestions

What if I would like to create a loop on monitoiring the file ABC.xls
status, anytime if the file ABC.xls is updated after 10am of today, then
perform the macro, else skip and wait.
Do you have any suggestions?
Thank you very much for any suggestions
Eric

"Rick Rothstein (MVP - VB)" wrote:

Note that I am indicating the file's path be provided along with its
name...

If FileDateTime("c:\FilesPath\ABC.xls") Date + TimeSerial(10, 0, 0)
Then
' The file's last modified date is later than 10am today
End If

The FileDateTime function is a built-in function in VBA which returns the
last modified date for the PathFileName passed into it as an argument.

Rick


"Eric" wrote in message
...
Does anyone have any suggestions on how to perform following tasks in
macro?
I would like to check the last updated for the file ABC.xls, if the
last
updated is today after 10am, then perform macro, else skip running the
rest
of coding.
Does anyone have any suggestions?
Thank you in advance for any suggestions
Eric




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
Coding metaltecks Excel Discussion (Misc queries) 1 April 17th 06 10:12 PM
VBA coding nir020 Excel Programming 3 January 17th 06 01:04 PM
"=ROW()-1" type of coding doesn't appear in a filter / is there coding that does? StargateFan[_3_] Excel Programming 10 October 6th 05 01:18 PM
Implant macro coding into ASP coding Sam yong Excel Programming 5 September 15th 05 10:37 AM
Coding help fpd833 Excel Programming 2 November 12th 04 08:22 PM


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