Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Get the path to My documents folder in VB6

Posted on 2006-05-05
3
Medium Priority
?
5,148 Views
Last Modified: 2011-09-22
Hi !

I need to get the path to the current users myDocuments folder :-)

regards
0
Comment
Question by:MRSONNY
3 Comments
 
LVL 3

Expert Comment

by:AbhishekSharma
ID: 16613115
Please write your question in Detail.
0
 
LVL 29

Accepted Solution

by:
nffvrxqgrcfqvvc earned 200 total points
ID: 16613281

Option Explicit

Private Declare Function SHGetSpecialFolderPathW Lib "shell32.dll" ( _
    ByVal hwndOwner As Long, _
    ByVal lpszPath As Long, _
    ByVal nFolder As Long, _
    ByVal fCreate As Long) As Boolean

Private Const MD As Long = &H5
   
    Public Function My_Documents() As String
   
    Dim Folders(512) As Byte
   
    My_Documents = vbNullString
   
    If SHGetSpecialFolderPathW(0&, _
        ByVal VarPtr(Folders(0)), _
            MD, 0&) Then
        My_Documents = Left$(Folders, InStr(Folders, Chr$(0)) - 1)
    End If
   
    Erase Folders
   
    End Function
   
Private Sub Command1_Click()
    MsgBox My_Documents
End Sub
0
 

Author Comment

by:MRSONNY
ID: 16613295
Hi !

I basicly need to open a folder in the mydocuments folder of the current logged on user, like this :


Dim rtVal As Long
rtVal = Shell("explorer C:\Documents and Settings\USERNAME\My Documents\IncomingFiles", vbNormalFocus)
End Sub


regards
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month10 days, 8 hours left to enroll

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question