Better App.Path Function

By | 2007-05-03

App.Path returns a string with the “\” character at the end if the path is the root drive (e.g., “C:\”) but without that character if it isn’t (e.g., “C:\Program Files”). Most of the time we need the “\” at the end, so this function saves you the inconvenience of adding it every time.

Public Function AppPath() As String

    Dim sAns As String
    sAns = App.Path
    If Right(App.Path, 1) <> "\" Then sAns = sAns & "\"
    AppPath = sAns

End Function

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.