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

dirlistbox to variables to a file 1

Status
Not open for further replies.

Cimso

Technical User
Sep 25, 2001
22
US
Say I had a return of C:\shop\data\mdb from a dirlistbox. Would there be a way to make the drive letter and the returned directories into variables
so..
C = W, shop = x, data = y, mdb = z and then write that to a file and say...

W:
CD X
CD Y
CD Z

I'm quite new at all of this. Thank you to all that have helped.

 
Try this:
(assuming strDir contains the Directory-String)
Dim arr() As String
Dim strToFile As String
arr = split(strDir,"\")

strToFile = arr(0)
if ubound(arr)>0 then
for i=1 to ubound(arr)
strToFile = strToFile & vbcrlf & "CD " & arr(i)
next
end if

Now write strToFile into a file (hope you know how to do that) and you are done.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top