Excel VBA - How to Check if File Exists (Dir function)

preview_player
Показать описание
Excel VBA Check to see if a file exists using Dir function

The code used in this video:

Sub CheckIfFileExists()
Dim MyFile As String

If Dir(MyFile) "" Then
MsgBox "File exists"
Else
MsgBox "File does not exist"
End If

End Sub
Рекомендации по теме
Комментарии
Автор

You are the one... Nice explanation and beautiful voice

cfelipesilva
Автор

No sabes cuanto me gusta tu voz, en serio :*

alexandermurciacalderon
Автор

hello nice one. If i want to take the file path from my excel column exp-C1 and check on D1 and every time this values get changed C2, C3, C4 then what i need to do.

newlearning
Автор

Hi, do you have tutorial that shows how to read a sharepoint folder file contents from vba

manishagrawal
Автор

what if I want to check if a file exists on Google drive then execute the VBA code. Means, If shared drive abc.txt exists in google drive or onedrive, then open the excel file, else Exit sub and close the application. Thanks.

gates
Автор

yep...everything fine. But that voice, that voice does this video...I like it

oldestnewman
Автор

I have a list of item references in A1 to A200, I would like to know in B column if item photo exist in C:\Photos directory.
I need in Column B in the same row to show me True or False, (True mean file exist and False mean does not exist) with function please help;

MegaHeadach
Автор

Why are you so nervous, while hitting keyboard strongly :D

zozozozo
welcome to shbcf.ru