your FileFolderExists() function probably utilizes the Filesytem object
and has something like:
 
if (fso.fileexists(filename)) then
 
you need to EITHER modify your FileFolderExists function 
to also use:
 
set f = fso.getfile(filename)
if (datediff("d",f.datelastmodified,now()) = 0) then
 
 
or add a variation of this to your parent macro.
 (which runs if the filefolderexists function returns "true")
 
 

Paul
-----------------------------------------
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
-----------------------------------------


>________________________________
> From: USMAN TARIQ <usman.tariq1...@gmail.com>
>To: excel-macros@googlegroups.com 
>Sent: Tuesday, November 18, 2014 10:26 AM
>Subject: Re: $$Excel-Macros$$ Error in VBA
>  
>
>
>i have figured out the issue the following code works . but actually in our 
>project the updated files are replaced everyday .
>
>For example there is a file called Report A, it was delivered on 11/17 , but 
>is not delivered  on 11/18 , in the folder the one that is delivered still 
>exist , but in my excel i want to show blank , because the latest one is not 
>available 
>
>
>
>Private Sub TestFileExistence()
>
>
> If FileFolderExists("\\cf3.pepsico.pvt\psra\Output\BI4\PSRA Day Tracker - 
> Exec.mhtml") And _
>       Weekday(Date) = 2 Then
>
>
>
>Range("P4").Value = "X"
>
>
>End If
>
>End Sub
>
>So basically the code looks for the name of file , and if the name exist, then 
>it puts X in Excel.
>
>What i want the code should look for the Current Date File (like if we can tie 
>the Date Modified also with the name of the file ) , if that exist then it 
>should put X else if its old one then just leave it blank
> 
>
>
>
>
>
>On Thu, Nov 13, 2014 at 10:49 AM, USMAN TARIQ <usman.tariq1...@gmail.com> 
>wrote:
>
>I FIGURED IT OUT ! , :)  There was " _" missing after "And"
>>
>>
>>its working now 
>>
>>
>>Thanks 
>>
>>
>>On Thu, Nov 13, 2014 at 10:42 AM, Paul Schreiner <schreiner_p...@att.net> 
>>wrote:
>>
>>is FileFolderExists() a custom function?
>>>
>>>is this email wrapping?
>>>that is, is this actually one line?
>>>
>>>If FileFolderExists("\\cf3.pepsico.pvt\psra\Output\BI4\Exec Dollars - 
>>>Current Period.pdf")and
>>>weekday(date) = 2 Then
>>>
>>> 
>>>if so, be sure there's a space after the )If 
>>>FileFolderExists("\\cf3.pepsico.pvt\psra\Output\BI4\Exec Dollars - Current 
>>>Period.pdf") and weekday(date) = 2 Then
>>>
>>>I usually prefer to use more ( ):
>>> 
>>>If ((FileFolderExists("\\cf3.pepsico.pvt\psra\Output\BI4\Exec Dollars - 
>>>Current Period.pdf")) _
>>>and (weekday(date) = 2) _
>>>) Then
>>>
>>>
>>>Paul
>>>-----------------------------------------
>>>“Do all the good you can,
>>>By all the means you can,
>>>In all the ways you can,
>>>In all the places you can,
>>>At all the times you can,
>>>To all the people you can,
>>>As long as ever you can.” - John Wesley
>>>-----------------------------------------
>>>
>>>
>>> From: USMAN TARIQ <usman.tariq1...@gmail.com>
>>>>To: excel-macros@googlegroups.com 
>>>>Sent: Thursday, November 13, 2014 10:07 AM
>>>>Subject: $$Excel-Macros$$ Error in VBA
>>>>  
>>>>
>>>>
>>>>Compile Error:
>>>>Syntax Error 
>>>>
>>>>
>>>>the above error is coming for the below code . it happens when inject the 
>>>>Day condition 
>>>>
>>>>Private Sub TestFileExistence()
>>>>
>>>>
>>>>If FileFolderExists("\\cf3.pepsico.pvt\psra\Output\BI4\Exec Dollars - 
>>>>Current Period.pdf")and
>>>>weekday(date) = 2 Then
>>>>
>>>>Range("A1").Value = "X"
>>>>
>>>>Else
>>>>
>>>>Range("A1").Value = "!"
>>>>
>>>>End If
>>>>End Sub
>>>>
-- 
>>>>Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
>>>>=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
>>>>https://www.facebook.com/discussexcel
>>>> 
>>>>FORUM RULES
>>>> 
>>>>1) Use concise, accurate thread titles. Poor thread titles, like Please 
>>>>Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice 
>>>>will not get quick attention or may not be answered.
>>>>2) Don't post a question in the thread of another member.
>>>>3) Don't post questions regarding breaking or bypassing any security 
>>>>measure.
>>>>4) Acknowledge the responses you receive, good or bad.
>>>>5) Jobs posting is not allowed.
>>>>6) Sharing copyrighted material and their links is not allowed.
>>>> 
>>>>NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
>>>>members are not responsible for any loss.
>>>>--- 
>>>> You received this message because you are subscribed to the Google Groups 
>>>> "MS EXCEL AND VBA MACROS" group.
>>>>To unsubscribe from this group and stop receiving emails from it, send an 
>>>>email to excel-macros+unsubscr...@googlegroups.com.
>>>>To post to this group, send email to excel-macros@googlegroups.com.
>>>>Visit this group at http://groups.google.com/group/excel-macros.
>>>>For more options, visit https://groups.google.com/d/optout.
>>>>
>>>>
>>>>    -- 
>>>Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
>>>=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
>>>https://www.facebook.com/discussexcel
>>> 
>>>FORUM RULES
>>> 
>>>1) Use concise, accurate thread titles. Poor thread titles, like Please 
>>>Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will 
>>>not get quick attention or may not be answered.
>>>2) Don't post a question in the thread of another member.
>>>3) Don't post questions regarding breaking or bypassing any security measure.
>>>4) Acknowledge the responses you receive, good or bad.
>>>5) Jobs posting is not allowed.
>>>6) Sharing copyrighted material and their links is not allowed.
>>> 
>>>NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
>>>members are not responsible for any loss.
>>>--- 
>>>You received this message because you are subscribed to a topic in the 
>>>Google Groups "MS EXCEL AND VBA MACROS" group.
>>>To unsubscribe from this topic, visit 
>>>https://groups.google.com/d/topic/excel-macros/flur73p1oBA/unsubscribe.
>>>To unsubscribe from this group and all its topics, send an email to 
>>>excel-macros+unsubscr...@googlegroups.com.
>>>To post to this group, send email to excel-macros@googlegroups.com.
>>>Visit this group at http://groups.google.com/group/excel-macros.
>>>For more options, visit https://groups.google.com/d/optout.
>>>
>> 
>
-- 
>Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
>=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
>https://www.facebook.com/discussexcel
> 
>FORUM RULES
> 
>1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
>Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
>quick attention or may not be answered.
>2) Don't post a question in the thread of another member.
>3) Don't post questions regarding breaking or bypassing any security measure.
>4) Acknowledge the responses you receive, good or bad.
>5) Jobs posting is not allowed.
>6) Sharing copyrighted material and their links is not allowed.
> 
>NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
>members are not responsible for any loss.
>--- 
>You received this message because you are subscribed to the Google Groups "MS 
>EXCEL AND VBA MACROS" group.
>To unsubscribe from this group and stop receiving emails from it, send an 
>email to excel-macros+unsubscr...@googlegroups.com.
>To post to this group, send email to excel-macros@googlegroups.com.
>Visit this group at http://groups.google.com/group/excel-macros.
>For more options, visit https://groups.google.com/d/optout.
>
>
>    

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

Reply via email to