Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Using FSO..
Dim strFile As String, fso As Object strFile = Trim(Range("C5")) Set fso = CreateObject("Scripting.FileSystemObject") If fso.FolderExists(Left(strFile, InStrRev(strFile, "\") - 1)) Then MsgBox "Folder exists" End If If this post helps click Yes --------------- Jacob Skaria "Jacob Skaria" wrote: Dim strFile as String strFile = Trim(Range("C5")) If Dir(Left(strFile, InStrRev(strFile, "\")), vbDirectory) = "" Then MsgBox "Invalid Path" End If PS: Alternatively you can also use FSO FileSystemObject to validate... If this post helps click Yes --------------- Jacob Skaria "Souny" wrote: Good morning, I have cells C5:C10 (merged cells) in my worksheet "Sheet1" where users can type in a path, including the file name (e.g. "C:\File.xls"), that users want to save the workbook. I need some help to write a code to validate the path to make sure that the path is correct. If the path is not correct, I want to message the users that the path you have entered is not a correct path format. This code will be part of if - then statement of my other code. Please help. Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
File Path Too Long? Not Anymore! Check out Long Path Tool | Excel Discussion (Misc queries) | |||
How can I show a validity by a prompted symbol in colour? | Excel Worksheet Functions | |||
Check path and files | Excel Programming | |||
=VLOOKUP validity | Excel Programming | |||
Recordset object loses validity in call between function & subrout | Excel Programming |