#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Param
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Daniel CHEN
 
Posts: n/a
Default 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" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Charting data points and show a target range on the same chart. Minireefkeeper Charts and Charting in Excel 6 February 18th 06 06:50 PM
count the # of entries when sum matches the target [email protected] Excel Worksheet Functions 4 February 15th 06 01:01 AM
Return Numerical Label for LAST value Subtracted to reach Sum Target Value Sam via OfficeKB.com Excel Worksheet Functions 17 October 31st 05 01:46 PM
Setting traffic lights based on todays date against target dates HDV Excel Discussion (Misc queries) 2 September 14th 05 12:05 PM
Splitting a Target Figure oldgit99 Excel Worksheet Functions 3 August 23rd 05 02:50 PM


All times are GMT +1. The time now is 03:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"