Power Query Course in Spanish
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Changing Directories

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Posts
    110
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I WANT THE CHECK TO SEE THAT MY PATH(THE PATH OF THE CURRENT FILE I'M IN) AND THE CURRENT DIRECTORY ARE THE SAME. IF NOT, I
    WANT TO CHANGE THE CURRENT DIRECTORY TO MY PATH. THE CODE BELOW DOESN'T CHANGE "MY DOCUMENTS" TO THE FOLDER OF THE FILE I'M IN.

    THANKS,
    Mike

    Dim strThispath As String
    Dim strThisCurDir As String

    strThispath = Application.ThisWorkbook.Path
    strThisCurDir = CurDir

    If strThisCurDir <> strThispath Then
    ChDir strThispath
    End If


  2. #2
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Check what Drive you are in...if diff then
    you'll have to change drive 1st.

    eg ChDrive "D:"

    Ivan

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
  •