Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Christchurch, New Zealand
    Posts
    250
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Getting Current Folder Name

    I am having a problem trying to find out how to get the current folder name. I can use CurDir but this returns the entire path and I only want the folder name. I have no way of knowing how many levels/sublevels of folders I may be in, and don't want to display them anyway.

    I've tried using Dir but just get a fullstop . for the current folder name.

    I'm tearing my hair out so any suggestions would be appreciated.

    Thanks.

  2. #2
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Getting Current Folder Name

    Karen,

    What about something like this:
    <pre>Dim strFolder As String
    Dim i As Integer
    strFolder = CurDir

    For i = Len(strFolder) To 1 Step -1
    If Mid$(strFolder, i, 1) = "" Then
    strFolder = Mid$(strFolder, i + 1)
    Exit For
    End If
    Next
    </pre>

    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Christchurch, New Zealand
    Posts
    250
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Getting Current Folder Name

    [img]/w3timages/icons/yep.gif[/img]Thank you - worked a treat. I kept trying instr and getting myself very muddled!

    Thanks again.

Posting Permissions

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