Results 1 to 3 of 3

Thread: Get Folder Name

  1. #1
    Member
    Join Date
    2009-02
    Location
    London, England
    Posts
    21
    Login to Give a bone
    0

    Default Get Folder Name

    Hi

    I Need to find the folder name where the open dwg resides.

    I know I can get the full path simply by
    Code:
    Dim Filename As String
    Filename = ThisDrawing.FullName
    Hope someone can help

  2. #2
    Active Member
    Join Date
    2008-06
    Posts
    52
    Login to Give a bone
    0

    Default Re: Get Folder Name

    you can use

    Thisdrawing.Path

    If you need to break it down more than that then look at the "Right" & "InStrRev" functions

  3. #3
    Active Member
    Join Date
    2008-02
    Location
    Central IL
    Posts
    53
    Login to Give a bone
    0

    Default Re: Get Folder Name

    Here are some examples of how to use the InStrRev function:
    Code:
    Public Sub FilenameAndPath()
        
        Dim FullFileName As String
        FullFileName = ThisDrawing.FullName
        
        Dim Path As String
        Dim FileName As String
        
        'Find the first backslash from the right of the string.
        'This can be used to seperate the filename from subsequent folders.
        Dim slashLocation As Integer
        slashLocation = InStrRev(FullFileName, "\", -1, vbTextCompare)
        
        Path = Left(FullFileName, slashLocation)
           
        FileName = Mid(FullFileName, slashLocation + 1, _
            Len(FullFileName) - slashLocation)
        
        'display the values in the immediate window.
        Debug.Print "Path: " & Path
        Debug.Print "FileName: " & FileName
        
    End Sub

Similar Threads

  1. Replies: 1
    Last Post: 2015-07-15, 06:38 PM
  2. Replies: 0
    Last Post: 2011-11-03, 07:10 AM
  3. Replies: 0
    Last Post: 2011-05-30, 07:07 AM
  4. Folder naming and allowable characters in folder names
    By fletch97 in forum CAD Management - General
    Replies: 7
    Last Post: 2006-10-26, 06:01 AM

Posting Permissions

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