Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

File reference syntax

15 views
Skip to first unread message

JHB

unread,
Jul 11, 2012, 12:59:55 PM7/11/12
to
Hi:

I am attmpting to find out if a file exists using a routine copied
from someone else in the form of a visual baseic module. I am using a
puublic funcytion hat says the following:


Public Function FileFolderExists(strFullPath As String) As Boolean
'Author : Ken Puls (www.excelguru.ca)
'Macro Purpose: Check if a file or folder exists
On Error GoTo EarlyExit
If Not Dir(strFullPath, vbDirectory) = vbNullString Then
FileFolderExists = True

EarlyExit:
On Error GoTo 0
End Function

To call it, I am using a tailored function as follows:

Public Sub SchedImportTHERE()
'Author : Ken Puls (www.excelguru.ca)
'Macro Purpose: Test if directory exists
Sheets("FILELIST").Select

Range("D2").Select
Filename = ActiveCell()

If FileFolderExists(Filename) Then
MsgBox "File exists!"
Else
MsgBox "File does not exist!"
End If
End Sub

The Contents of cell D2 is a constructed file reference based on
history. My problem is that while the actual value in D2 is 100%
correct, the way that I have set up the actual call to the
FileFolderExists function is wrong!

I know that it is in the way I have constructed the call and that
(Filename) is wrong. I just do not know how to fix it! If I substitute
the actual file address into Filename, ("C:/download/names.xls") it
works fine.

Help please

John baker

JHB

unread,
Jul 11, 2012, 12:59:22 PM7/11/12
to

kara...@irchiver.com

unread,
Oct 13, 2012, 6:19:36 PM10/13/12
to
Note sure if this post belongs in this section.

On Wed, 11 Jul 2012 09:59:55 -0700 (PDT), JHB <baker...@gmail.com>
wrote:
0 new messages