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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get the path of the excel file...

Status
Not open for further replies.

Fursten

Programmer
Dec 27, 2000
403
PT
Hi,

In a directoy I have an excel file. In that same directory I have a text file.

My excel file will read the text file, however I want it to find that text file without the user need to choose it.

In VB I could use: app.path & "nameofthefile", however i can´t do it in VBA :(

Is there any way to say to excel file to look for the text file in same directory as it stands?

thank you

Sergio Oliveira
 
use
ActiveWorkbook.Path
or
Application.ThisWorkbook.Path

f.e.:
Const sTxtFileName = "myFileName.txt"
MsgBox ActiveWorkbook.Path & "\" & sTxtFileName

ide
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top