+ Reply to Thread
Results 1 to 2 of 2

define relative path from xls to xml file

  1. #1

    define relative path from xls to xml file

    Hi All,

    i have an excel-project with a separate xml file where config
    information is stored. this xml is reference through a public constant
    with an absolute path, like that:

    Public Const strXMLFile As String = "D:\Documents and
    Settings\t119637\Desktop\xls_work\Config\config.xml"

    This works as long as the xls file runs on the machine where this
    absolute file path is existing.
    If i'd like to move these files (the excel file with the vba code and
    the xml file) to another machine where this path is not existing, the
    excel sheet wont work cause the xml file is not found.
    Is there a ways to define a relative path to the xml file startin from
    the actual xls file?
    E.g:
    the excel is stored in:
    xls_work/myFile.xls
    and the xml file is stored in
    xls_work\Config\config.xml

    So i would assume that the vba code needs to determine what the path to
    the xls file is and add a /Config/config.xml to that path to have the
    xls file work with the settings in the xml file.

    I dont know the vba code that makes this possible

    help woul be greatly apreciated
    regards
    thomas


  2. #2
    Trent Argante
    Guest

    RE: define relative path from xls to xml file

    Hi Thomas,
    Seeing that you haven't received any responces as of yet, the only relative
    path I know of is Application.Path, which returns the directory that the
    Excel application is stored in. But that would mean you'd have to store your
    files off of Excel's application path.
    Another "out there" idea is to load the relative-portion of the path from a
    text file.
    HTH
    Trent Argante
    [DC.J(n/a)]


    "[email protected]" wrote:

    > Hi All,
    >
    > i have an excel-project with a separate xml file where config
    > information is stored. this xml is reference through a public constant
    > with an absolute path, like that:
    >
    > Public Const strXMLFile As String = "D:\Documents and
    > Settings\t119637\Desktop\xls_work\Config\config.xml"
    >
    > This works as long as the xls file runs on the machine where this
    > absolute file path is existing.
    > If i'd like to move these files (the excel file with the vba code and
    > the xml file) to another machine where this path is not existing, the
    > excel sheet wont work cause the xml file is not found.
    > Is there a ways to define a relative path to the xml file startin from
    > the actual xls file?
    > E.g:
    > the excel is stored in:
    > xls_work/myFile.xls
    > and the xml file is stored in
    > xls_work\Config\config.xml
    >
    > So i would assume that the vba code needs to determine what the path to
    > the xls file is and add a /Config/config.xml to that path to have the
    > xls file work with the settings in the xml file.
    >
    > I dont know the vba code that makes this possible
    >
    > help woul be greatly apreciated
    > regards
    > thomas
    >
    >


+ 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