Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Strange Error

  1. #1
    Guest

    Default

    I have a period of codes as following:

    Dim category As String
    category = CurDir
    MsgBox category
    ChDir "F:IA"
    MsgBox CurDir

    It is very strange that the output message is always C:Documents and settingsAdiministratorMy Documents

    Can you tell me why? How to fix the problem? i want to output the current folder name(not full one).
    TIA

  2. #2
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi

    The ChDir statement changes the default directory but not the default drive!

    What you probably need is something like:

    Dim category As String
    category = CurDir
    MsgBox category
    ChDrive "F:\IA"
    MsgBox CurDir


    Or

    Dim category As String
    category = CurDir
    MsgBox category
    ChDrive "F:"
    ChDir "F:\IA"
    MsgBox CurDir


  3. #3
    Guest

    Default

    Maybe i made a mistake.
    I had thought that the CurDir function will return me the current folder name of current file or current folder.
    So what's the actual usage of CurDir. The help file on it is too simple

  4. #4
    Guest

    Default

    So the problem comes to decide the folder name of a file, the direct foler containing the file, not the full path.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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