This will also work
Code:
Sub VBACheckIfFileExists()
Dim StrDirBack As String
Let StrDirBack = Dir("C:\Users\WolfieeeStyle\Desktop\FundsCheck.xlsb", vbNormal)
If StrDirBack = "" Then
MsgBox prompt:="Download2"
End If
Let StrDirBack = Dir("C:\Users\WolfieeeStyle\Desktop\1.xls", vbNormal)
If StrDirBack = "" Then
MsgBox prompt:="Download1"
End If
End Sub
And also this will work.
Code:
Sub VBACheckIfFileExists()
Dim StrDirBack As String
Let StrDirBack = Dir("C:\Users\WolfieeeStyle\Desktop\FundsCheck.xlsb", vbNormal)
If StrDirBack = "" Then MsgBox prompt:="Download2"
Let StrDirBack = Dir("C:\Users\WolfieeeStyle\Desktop\1.xls", vbNormal)
If StrDirBack = "" Then MsgBox prompt:="Download1"
End Sub
You can choose.
I like to use Else and also EndIf
It is just a personal choice.
Just my personal preference
With Else is good to add ' notes . Later I can remember what is all about
Code:
Sub VBACheckIfFileExists()
Dim StrDirBack As String
Let StrDirBack = Dir("C:\Users\WolfieeeStyle\Desktop\FundsCheck.xlsb", vbNormal)
If StrDirBack = "" Then
MsgBox prompt:="Download2"
Else ' My StrDirBack is = "FundsCheck.xlsb" so ...
' ... I do not do anything here
End If
Let StrDirBack = Dir("C:\Users\WolfieeeStyle\Desktop\1.xls", vbNormal)
If StrDirBack = "" Then
MsgBox prompt:="Download1"
Else ' My StrDirBack is = "1.xls" so ...
' ... I do not do anything here
End If
End Sub
Code:
Sub VBACheckIfFileExists()
Dim StrDirBack As String
Let StrDirBack = Dir("C:\Users\WolfieeeStyle\Desktop\FundsCheck.xlsb", vbNormal)
If StrDirBack = "" Then ' My StrDirBack is = "" ===='_-
MsgBox prompt:="Download2"
Else ' My StrDirBack is = "FundsCheck.xlsb" so ...
' ... I do not do anything here
End If ' End If StrDirBack = "" =================='_-
Let StrDirBack = Dir("C:\Users\WolfieeeStyle\Desktop\1.xls", vbNormal)
If StrDirBack = "" Then ' My StrDirBack is = "" ====|||
MsgBox prompt:="Download1"
Else ' My StrDirBack is = "1.xls" so ...
' ... I do not do anything here
End If ' End If StrDirBack = "" ==================|||
End Sub
But you can choose.
It is free world. Stay cool and do what you want - do anything you wanna do https://listenonrepeat.com/watch/?v=...o_-_1977_45rpm
Bookmarks