+ Reply to Thread
Results 1 to 2 of 2

Checking that file exist and if not display a message

  1. #1

    Checking that file exist and if not display a message

    Hi,

    wrote some code for this:

    Sub helpfile()

    Dim Thehelpfile As Boolean

    Thehelpfile = (Len(Dir("P:\Consignit
    Templates\Consignit\Word\helpfile\How to use the word templates.doc"))
    > 0)

    If Thehelpfile = True Then
    Application.Documents.Open Filename:="P:\Consignit
    Templates\Consignit\Word\helpfile\How to use the word templates.doc"
    Else
    MsgBox "This functionality only works on the CAB office
    Computers, You can download this help file from the intranet under
    Tools/Templates"
    Exit Sub
    End If
    End Sub

    The problem is that if I pull the networkcable I get an error message
    instead of the msgbox message I've written.

    How to amend this so that if the networkdrive containing this file is
    not available my message should appear?

    Please help.

    Thx!

    /Jan


  2. #2
    Tom Ogilvy
    Guest

    Re: Checking that file exist and if not display a message

    Sub helpfile()

    Dim Thehelpfile As Boolean
    Thehelpfile = False
    On Error Resume Next
    Thehelpfile = (Len(Dir("P:\Consignit
    Templates\Consignit\Word\helpfile\How to use the word templates.doc"))
    > 0)

    On Error goto 0
    If Thehelpfile = True Then
    Application.Documents.Open Filename:="P:\Consignit
    Templates\Consignit\Word\helpfile\How to use the word templates.doc"
    Else
    MsgBox "This functionality only works on the CAB office
    Computers, You can download this help file from the intranet under
    Tools/Templates"
    Exit Sub
    End If
    End Sub

    --
    Regards,
    Tom Ogilvy



    <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > wrote some code for this:
    >
    > Sub helpfile()
    >
    > Dim Thehelpfile As Boolean
    >
    > Thehelpfile = (Len(Dir("P:\Consignit
    > Templates\Consignit\Word\helpfile\How to use the word templates.doc"))
    > > 0)

    > If Thehelpfile = True Then
    > Application.Documents.Open Filename:="P:\Consignit
    > Templates\Consignit\Word\helpfile\How to use the word templates.doc"
    > Else
    > MsgBox "This functionality only works on the CAB office
    > Computers, You can download this help file from the intranet under
    > Tools/Templates"
    > Exit Sub
    > End If
    > End Sub
    >
    > The problem is that if I pull the networkcable I get an error message
    > instead of the msgbox message I've written.
    >
    > How to amend this so that if the networkdrive containing this file is
    > not available my message should appear?
    >
    > Please help.
    >
    > Thx!
    >
    > /Jan
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1