#1
|
|||
|
|||
Error in VBA code
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\BI 4\Exec Dollars - Current Period.pdf")and weekday(date) = 2 Then Range("A1").Value = "X" Else Range("A1").Value = "!" End If End Sub |
#2
|
||||
|
||||
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
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Quote:
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 |
#4
|
||||
|
||||
You evidently don't understand the issue. The OP already had that and it gives an error when used that way.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
error code 30029-4 | zignaasa | Office | 0 | 05-24-2014 10:07 PM |
Error Code 5453 Word has finished searching the document | Charles Kenyon | Word VBA | 2 | 05-17-2012 11:18 AM |
Code Error - Hiding comments and revisions | silvrwoman | Word VBA | 6 | 03-24-2012 10:15 PM |
Microsoft Code Error 1907 | JHauglid | Office | 1 | 02-27-2012 12:15 AM |
Error code 0x800CCC80 | Kevin | Outlook | 1 | 03-18-2011 07:20 AM |