View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Disable the prompt when clicking on a protected cell?

How about:

Dim FSO As Object
Dim outgoingFilePath As String

Set FSO = CreateObject("Scripting.FileSystemObject")

outgoingFilePath = "CC:\"

If FSO.folderexists(outgoingFilePath) Then
'keep going
MsgBox "It exists"
Else
'error message
MsgBox "Doesn't exist"
End If



wrote:

Thanks again Ron. I re-pasted the code into the VB excel object
associated with the entire workbook, i.e. 'ThisWorkbook'. It now works!
(Before it was pasted into some other excel object related to an
individual sheet. My apologies for the previous misunderstanding!)

Another question regarding directory path validation...The following
code works fine with normal path input:

'Set FileExists to FileSystemObject
If outgoingFilePath = "\" Or Dir(outgoingFilePath, vbDirectory)
= "" Then
MsgBox outgoingFilePath & " is not a valid file path.
Please try again", vbExclamation, "Invalid Path"
End
End If

However, it will fail if outgoingFilePath is somewhat outrageous, say
'C:C:\' or 'CC:\', in which case run-time error 52 is fired, stating
'Bad file name or number'. Idealy ANY incorrect path input should be
captured by the code instead, without generating any run-time
error...So how the above code can be fortified to properly handle ALL
input situations? Many thanks in advance!!

Regards
Frank


--

Dave Peterson