Interesting... here you are advocating using a method that might not be
guaranteed to work because it is simpler whereas in the "Isolate text in a
long url" thread you are advancing what appears to be an opposite position.
By the way, I completely agree with you on being against programs that drop
files on one's Desktop... my defense is that I was just answering the
question that was asked.<g>
--
Rick (MVP - Excel)
Rick Rothstein said:
'*************** START OF CODE ***************
Private Declare Function SHGetFolderPath Lib "shfolder" _
Alias "SHGetFolderPathA" (ByVal hwndOwner As Long, _
ByVal nFolder As Long, ByVal hToken As Long, _
ByVal dwFlags As Long, ByVal pszPath As String) As Long
Private Const CSIDL_DESKTOPDIRECTORY As Long = &H10
Function GetDesktopPath() As String
Dim strPath As String
Dim lngReturn As Long
strPath = String(255, 0)
lngReturn = SHGetFolderPath(0, CSIDL_DESKTOPDIRECTORY, 0, 0, strPath)
GetDesktopPath = Left$(strPath, InStr(1, strPath, Chr(0)) - 1)
End Function
'*************** END OF CODE ***************
....
This works, but
Function foo() As String
foo = Environ("USERPROFILE") & "\Desktop"
End Function
is arguably easier to understand and maintain. Granted users outside
environments governed by group policies could edit their Windows
registry to change their desktop folder from the default Desktop
subdir within their profile dir, so the simpler approach could return
the wrong result.
That said, I personally REALLY, REALLY HATE any application dropping
anything on my desktop. User's My Documents directory would usually be
a better place IF users' local folders were automatically backed up.
If not, better to save the files into users' file server home
directories which presumably are backed up automatically as part of
their file servers' automatic backup. If necessary, put shortcuts to
these files on users' desktops.