Thursday, March 16, 2017

Check folder exist or to create new folder

Sub folder_check()

Dim fso As New FileSystemObject

If fso.FolderExists(Environ("UserProfile") & "\desktop\test") Then
    MsgBox "Folder already exist!"
Else
    fso.CreateFolder (Environ("UserProfile") & "\desktop\test")
    MsgBox "Folder Created"
End If

End Sub

No comments:

Post a Comment

*INTERVIEW QUESTIONS

* Ques 01. What is the difference between ByVal and ByRef and which is default ? Ans-  ByRef : If you pass an argument by reference when...