![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
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 |
|
Guest
Posts: n/a
|
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 |
|
Guest
Posts: n/a
|
So the problem comes to decide the folder name of a file, the direct foler containing the file, not the full path.
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|