Results 1 to 3 of 3

Thread: module function question

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2005
    Posts
    1,364

    module function question

    I have this function in my Form1,Form2,Form3 .. a bit of stupid way to do it..

    VB Code:
    1. Function File_Exists(strFilePath As String)
    2.     If Dir(strFilePath, vbNormal + vbHidden + vbSystem + vbReadOnly) = "" Then
    3.         File_Exists = False
    4.     Else
    5.         File_Exists = True
    6.     End If
    7. End Function

    if i just simply put that in a module exactly how it is, will it work from form1,form2,form ?

    i use it like this..

    If File_Exists("C:\test.txt) Then... 'etc..

  2. #2
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: module function question

    Yes. To be sure you can declare it as Public Function...


    Has someone helped you? Then you can Rate their helpful post.

  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: module function question

    As you have it defined, your function returns a Variant and it would be a tiny bit better if you defined it this way...

    VB Code:
    1. Function File_Exists(strFilePath As String) [HL="#FFFF80"]As Boolean[/HL]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width