Ray said:
I would like to do the following;
If the folder "Morning Reports" does not exist on the desktop, then create
it.
Any ideas?
To get the Desktop's folder location requires a little api work. Paste this
code into a new module:
''' CODE START '''
Private Type SHITEMID
cb As Long
abID As Byte
End Type
'
Private Type ITEMIDLIST
mkid As SHITEMID
End Type
'
Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" _
(ByVal hWndOwner As Long, ByVal nFolder As Long, _
pidl As ITEMIDLIST) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" _
Alias "SHGetPathFromIDListA" _
(ByVal pidl As Long, ByVal pszPath As String) As Long
Public Function DesktopFolder() As String
Dim IDL As ITEMIDLIST
'
If SHGetSpecialFolderLocation(100&, 0&, IDL) = 0 Then
Path$ = Space$(512)
SHGetPathFromIDList ByVal IDL.mkid.cb, ByVal Path$
DesktopFolder = Left$(Path$, Instr(1, Path$, Chr$(0)) - 1)
End If
End Function
''' CODE END '''
Then, when you need the path simply type DesktopFolder().
So, to fully answer your question:
strFolder = DesktopFolder() & "\Morning Reports"
If Dir$(strFolder, vbDirectory) = "" Then
MkDir strFolder
End If