I need a Language independent way to get "My Documents" folder in VBA Excel 2003.
What I have:
Public Function MyDocsPath() As String
MyDocsPath = Environ$("USERPROFILE") & "\My Documents\"
End Function
Because the program will be used in at least 2 lang MS Windows, and the "My Documents" name changes for each language.
Is there a way, or should I try to figure out the system lang and become specific?
Using the Dir() function you can get the list of files and folders in a specific path. The Dir() function takes 2 input parameters, the directory path and the type of file we are looking for: What is this? strPath is the path of the directory which the files and folder are in.
This may suit:
Set WshShell = CreateObject("WScript.Shell")
strDocuments = WshShell.SpecialFolders("MyDocuments")
From: http://msdn.microsoft.com/en-us/library/0ea7b5xe.aspx
Although the special folder name is MyDocuments, it refers to the documents folder for several versions of Windows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With