+ Reply to Thread
Results 1 to 6 of 6

curdir malfunction?

  1. #1
    Registered User
    Join Date
    04-05-2007
    Posts
    3

    curdir malfunction?

    hey guys,

    as a newbie to VBA, I'm hoping someone can help me out...

    So I'm intersted in pointing to some certain files, for them to open in another application (Mappoint)... so that I can have a transportable, self-contained folder that can run on a CD, datastick, or other computer...

    so I have:

    Dim AK1 As MapPoint.Symbol
    Dim AKPath As String
    AKPath = curdir()

    Set AK1 = ThSymbols.Add("AKPath\br green circle.bmp")

    and I get an import error... which is fine... if in the immediate window I type in:
    ?AKPath
    I always get:
    C:\Documents and Settings\A Kolos\My Documents

    no matter whether I'm running the file from my datastick on the E: drive or from other directories, well within My Documents...

    It's as if curdir is just a default pointer to the My Documents...

    am I doing something wrong? How can I reset it?


    Thanks for your time,
    andriy

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Andriy,

    Looks like a simple typo. You posted...

    Please Login or Register  to view this content.
    Should be...

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    04-05-2007
    Posts
    3

    not quite

    thanks for the syntax correction Leith, however, I am still still having an import error...

    Whenever (before, during, after macro execution) I check to see the current path by using the curdir command, it always returns:
    C:\Documents and Settings\A Kolos\My Documents
    even if I am running the file from a different drive (e:\) or form a different folder (C:\Documents and Settings\A Kolos\My Documents\Thoracic\v35)

    how can I get CurDir to point at my actual path, and not at just My documents?

    thanks,
    andriy

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Andriy,

    To change the Current Directory to a path you want, use ChDir.

    Please Login or Register  to view this content.
    You may want to save the CurDir in a variable. Once your code has run you can restore the current directory back to what it was so your Excel files will be saved to their original location.

    Sincerely,
    Leith Ross

  5. #5
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    Is this worth noting:

    Please Login or Register  to view this content.
    This will set the workbook's current location (the location from where it was opened) to the variable AKPath. I would assume you could then do something like:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-05-2007
    Posts
    3

    thanks

    I'll try out your suggestions... I appreciate your insights!

    regards,
    andriy

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1