+ Reply to Thread
Results 1 to 2 of 2

Target

  1. #1
    Param
    Guest

    Target

    hi, I have macro command that link file A to file B
    Q: anyway to write this command without mention the directory e.g
    "C:\temp\b.xls"
    because all the file within one folder (e.g temp). I counter problem when
    copy this folder to another PC, where the location are not same. Like copy to
    my document and run it.

    sub foo()
    dim wbk as workbook
    set wbk=activeworkbook
    workbooks.open "C:\temp\b.xls"
    wbk.close
    end sub


  2. #2
    Daniel CHEN
    Guest

    Re: Target

    Try to use the following which opens the file in the same directory as the
    active workbook:

    sub foo()
    dim wbk as workbook
    set wbk=activeworkbook
    workbooks.open Activeworkbook.Path&"\b.xls"
    wbk.close
    end sub

    --
    Best regards,
    ---
    Yongjun CHEN
    =================================
    XLDataSoft - Data Analysis Expert, Excel/VBA Specialist
    - - - - www.XLDataSoft.com - - - -
    Free Excel-Based Data Processing Tool is Available for Download



    "Param" <[email protected]> wrote in message
    news:[email protected]...
    > hi, I have macro command that link file A to file B
    > Q: anyway to write this command without mention the directory e.g
    > "C:\temp\b.xls"
    > because all the file within one folder (e.g temp). I counter problem when
    > copy this folder to another PC, where the location are not same. Like copy
    > to
    > my document and run it.
    >
    > sub foo()
    > dim wbk as workbook
    > set wbk=activeworkbook
    > workbooks.open "C:\temp\b.xls"
    > wbk.close
    > end sub
    >




+ 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