• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Code Mess !

Hi,

Anyone please explain below code.
Code:
DTAddress = CreateObject("WScript.Shell").SpecialFolders("Desktop") & Application.PathSeparator
 
Run the following and look in the Immediate window (Ctrl+G if its not visible)
Code:
Sub h()

  DTAddress = CreateObject("WScript.Shell").SpecialFolders("Desktop") & Application.PathSeparator
  Debug.Print DTAdress
End Sub

It is a shortcut to retrieve the full directory path of the desktop
 
Useful when you want to access some user profile specific directories. There's one more similar function which you can check.
Code:
Sub GetEnv()
Dim i As Long
For i = 1 To 100
  If Len(Environ(i)) = 0 Then Exit For
  Debug.Print Environ(i)
Next i
End Sub
Shall give you computer environment variables.
 
Back
Top