jeffrey.demulling at usbank.com
jeffrey.demulling at usbank.com
Fri Apr 28 11:04:14 CDT 2006
I have two functions base on the Windows API that I use that are below: Public Function blnDirectoryExists(strDirectoryName As String) As Boolean Dim strDir As String On Error GoTo blnDirectoryExists_Error strDir = Dir(strDirectoryName, vbDirectory) If IsNull(strDir) Or strDir = "" Then blnDirectoryExists = False Else blnDirectoryExists = True End If On Error GoTo 0 Exit Function blnDirectoryExists_Error: MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure blnDirectoryExists of Module mdlFile" blnDirectoryExists = False End Function Public Sub CreateNewDirectory(strNewDirectoryName As String) On Error GoTo CreateNewDirectory_Error Select Case blnDirectoryExists(strNewDirectoryName) Case False Call MkDir(strNewDirectoryName) End Select On Error GoTo 0 Exit Sub CreateNewDirectory_Error: MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure CreateNewDirectory of Module mdlFile" End Sub Jeffrey F. Demulling Project Manager U.S. Bank Corporate Trust Services 60 Livingston Avenue EP-MN-WS3C St. Paul, MN 55107-2292 Ph: 651-495-3925 Fax: 651-495-8103 email: jeffrey.demulling at usbank.com "Heenan, Lambert" <Lambert.Heenan at a ig.com> To Sent by: "'Access Developers discussion and accessd-bounces at d problem solving'" atabaseadvisors.c <accessd at databaseadvisors.com> om cc Subject 04/28/2006 10:54 Re: [AccessD] Make Folder Problem AM Please respond to "Access Developers discussion and problem solving" <accessd at database advisors.com> I don't think you can create a path like "C:\Files\Excel\Scaleup10" in one step. You need to check if "C:\Files" exists first, then "C:\Files\Excel" and then finally "C:\Files\Excel\Scaleup10", creating folders along the way. Lambert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kaup, Chester Sent: Friday, April 28, 2006 10:48 AM To: Access Developers discussion and problem solving Subject: [AccessD] Make Folder Problem I use the following code on my machine to create a folder and it works fine. Just tried it on another users machine and got a message could not create folder. I was able to do it manually. Any thoughts? ChDrive "C:" Set fso = CreateObject("Scripting.FileSystemObject") ResultsPath = "C:\Files\Excel\Scaleup10" If Not fso.folderexists(ResultsPath) Then MkDir "C:\Files\Excel\Scaleup10" End If Chester Kaup Engineering Technician Kinder Morgan CO2 Company, LLP Office (432) 688-3797 FAX (432) 688-3799 No trees were killed in the sending of this message. However a large number of electrons were terribly inconvenienced. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com ------------------------------------------------------------------------------ Electronic Privacy Notice. This e-mail, and any attachments, contains information that is, or may be, covered by electronic communications privacy laws, and is also confidential and proprietary in nature. If you are not the intended recipient, please be advised that you are legally prohibited from retaining, using, copying, distributing, or otherwise disclosing this information in any manner. Instead, please reply to the sender that you have received this communication in error, and then immediately delete it. Thank you in advance for your cooperation. ==============================================================================