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

return the my documents directory? 1

Status
Not open for further replies.

Junior1544

Technical User
Apr 20, 2001
1,267
US
is there a line of code of call that i can make to the os that will return the My Documents directory?? i would like to default an open dialog to my users my doc's directory... any idea's?

--James JHauge@jmjpc.net
Life is change. To deny change is to deny life.
 
Not that I know of. What I do is have an MS-DOS batch file attached to a button, and this file creates a text file of the file listing. The batch code is

DIR *.* > FILES.TXT.

Then I import this text file into a database table for viewing and parsing as necessary.

Hope this helps. "Get it right the first time, that's the main thing..." [wavey]
 
ok, i guess i'll have to hard code it a bit... thanks...

--Junior JHauge@jmjpc.net
Life is change. To deny change is to deny life.
 
if you assume my documents is always c:\My Documents

sPathName = "c:\My Documents\*.*"
sFileName = Dir$(sPathName)
Do While sFileName > ""
'Process sFileName
sFileName = Dir$
Loop

will give each filename individually
 
the problem is, i'm in a multy user enviroment, with windows 2k... so my my doc's directory is like this...

c:\documents and settings\user_name\my documents

what i'm going to do, is hard code most of it, and just pull the user name and put that into the string... thanks for the helps guys...

--James JHauge@jmjpc.net
Life is change. To deny change is to deny life.
 
dim mydocs as string
mydocs = "C:\Documents and Settings\" & CurrentUser & _
"\My Documents"


this is how i did it, i'm just glad that i had used the network username the same as the database username:)

this works for me, in windows 2k...

--James
JHauge@jmjpc.net
Life is change. To deny change is to deny life.
 
If you have windows scripting installed, then use it:

Function GetDocs()
Dim WshShell As Object
Set WshShell = CreateObject("WScript.Shell")
GetDocs = WshShell.SpecialFolders("MyDocuments")
End Function

MyDocuments can be replaced with any of the special folders:

AllUsersDesktop
AllUsersStartMenu
AllUsersPrograms
AllUsersStartup
Desktop
Favorites
Fonts
MyDocuments
NetHood
PrintHood
Programs
Recent
SendTo
StartMenu
Startup
Templates


Ben ----------------------------------
Ben O'Hara
bo104@westyorkshire.police.uk
----------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top