By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,053 Members | 1,595 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,053 IT Pros & Developers. It's quick & easy.

Writing files to My Documents

P: n/a
In a network situation, if you write files to the My Documents folder, would
it go to a different folder for each person's logon?

If so, how do I send a text file to My Documents with Docmd.TransferText. I
currently do this to a folder on the C drive, I am just not too sure about
how to incorporate My Documents instead of C:\Foldername\...

dixie
Jun 20 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Tue, 20 Jun 2006 13:36:34 +1000, "Dixie" <di***@dogmail.com> wrote:

Each person is logged in to his/her own machine, and as such has
his/her own My Documents folder. The network has nothing to do with it
(unless you're on WinTS or Citrix).

If you want to find out where the My Documents folder is, you have to
ask Windows. Below is some code I snagged.

Private Declare Function SHGetSpecialFolderLocation Lib "Shell32" _
(ByVal hwnd As Long, ByVal nFolder As Long, ppidl As Long) As Long
Private Declare Function SHGetPathFromIDList Lib "Shell32" _
(ByVal Pidl As Long, ByVal pszPath As String) As Long

Function MyDocumentsFolder() As String
Dim Pidl As Long
MyDocumentsFolder = Space$(260)
SHGetSpecialFolderLocation 0, 5, Pidl
SHGetPathFromIDList Pidl, MyDocumentsFolder
MyDocumentsFolder = Left$(MyDocumentsFolder, _
InStr(1, MyDocumentsFolder, vbNullChar) - 1)
End Function

Sub Test()
MsgBox "My Documents folder = " & MyDocumentsFolder()
End Sub

-Tom.

In a network situation, if you write files to the My Documents folder, would
it go to a different folder for each person's logon?

If so, how do I send a text file to My Documents with Docmd.TransferText. I
currently do this to a folder on the C drive, I am just not too sure about
how to incorporate My Documents instead of C:\Foldername\...

dixie


Jun 20 '06 #2

P: n/a
In some network setups, the powers to be will also setup a "My
Documents" for the user on the network drive also.

If you go into explorer and go to either of them (and set the option to
show the drive location in explorer) you will see the mapping to the
"My Documents" folder. That is constant and will not change. And, if it
is the network version, it is unique for each and every user logged on,
and accessable only by that user. Many networks are set up with limits
on the amount of space each user can use, so this version is probably
NOT the one that you will want to use - they could be out of space.

For the harddrive version, it is different (but similar) for every
operating system, so the code suggested would probably be a good place
to go.

Ron

Jun 20 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.