Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking to Excel Sheet 1

Status
Not open for further replies.

montana9550

Programmer
Jul 19, 2004
21
US
I have a program that draws data from an Excel sheet and in the program it spells out exactly where to find the data- "D:/data/etc."
Is there a way to tell the program to look in the directory that the program itself is located, even if it's on a CD (D:?) or on a hard drive (C:?) or on a flash drive (E:?) Being that any of these drive letters can be different on any given computer.
Basicly is there a way to tell the program to look in the root directory?

Thanks
 
This is the code I'm using now, I'm not exactly sure how to apply your answer ("App.Path")
'
Set xlApp=CreateObject("Excel.Application")
Name2="C:\data\standBy.xls"
Set xlbook=xlApp.Workbooks.Open(fileName:=Name2)
'
? Name2= App.Path "\data\standBy.xls" ?

Is this the right syntax???

thanks for your time
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top