Thread: [Solved] Error in VBA code
View Single Post
 
Old 11-27-2014, 08:10 AM
Bruno Campanini Bruno Campanini is offline Windows 8 Office 2013
Novice
 
Join Date: Nov 2014
Posts: 19
Bruno Campanini is on a distinguished road
Arrow

Quote:
Originally Posted by macropod View Post

Quote:
I assume you have a function 'FileFolderExists' somewhere, since that's not a native VBA function.

Try:
Code:
Private Sub TestFileExistence()
If Dir("\\cf3.pepsico.pvt\psra\Output\BI 4\Exec Dollars - Current Period.pdf", vbNormal) <> "" Then
  If Weekday(Date) = 2 Then
    Range("A1").Value = "X"
  Else
    Range("A1").Value = "!"
  End If
Else
  Range("A1").Value = "!"
End If
End Sub
Don't waste paper and ink... it's a matter of logic:

If Dir("\\cf3.pepsico.pvt\psra\Output\BI 4\Exec Dollars - Current Period.pdf", vbNormal) <> "" And Weekday(Date) = 2 Then
[A1] = "X"
Else
[A1] = "!"
End If

Bruno
Reply With Quote