Ken
Fri Dec 03 09:38:28 CST 2004
"Billy" <Billy@discussions.microsoft.com> wrote in message
news:5F449BF5-F616-4B70-A61D-FF2812F1217D@microsoft.com...
> Anyone know why the code below returns an "Run-time error '76' - path not
> found" error?
>
> The file (sFileName) does exist, as does the path
>
> ************************************
> Private Sub LoadFile(sFileText As String, sFileName As String)
> Dim f As Long
> f = FreeFile
'Try......
If FileExists(sFileName) Then
> Open sFileName For Input As #f
> sFileText = StrConv(InputB$(LOF(f), f), vbUnicode)
> Close #f
Else
MsgBox "File: " & sFileName & " not found"
End If
> End Sub
> ************************************
Private Function FileExists(FileName As String) As Boolean
On Error Resume Next
If Len(FileName) > 0 Then
FileExists = ((GetAttr(FileName) And vbDirectory) = 0)
Err.Clear
End If
End Function
--
Ken Halter - MS-MVP-VB -
http://www.vbsight.com
Please keep all discussions in the groups..