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

How do I get a directory name? 1

Status
Not open for further replies.

greinem

Programmer
May 3, 2001
14
0
0
US
Hi all,

I am using GetFileOpenName to get a file name returned back to my datawindow object. I would like to just get the directory path instead of additional selecting a file too.

For example:
My app calls GetFileOpenName and I get a file in g:\userhomedir\excel\example.xls THIS WORKS GREAT!

I want to just get the directory name (not the file included) using the similar technique like GetFileOpenName. Does anyone know of a function to help me? Thanks in advance.

p.s. PB 6.5 using WinXP thx - Mike
 
Get the directory name and then strip off the last part of the string after the last slash "\."

Just use the POS LEFT and LEN functions to calculate the location of the last slash...


li_rtn = GetFileSaveName("Database Location",
ls_docname, ls_loc, "mdb",
"Access Database Files (*.mdb),*.mdb")

ls_browse_dir = LEFT(ls_docname,
POS(ls_docname, ls_loc, 1) - 2)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top