![]() |
office Standard 32 bit MkTree Function - Make sure
Just lately, I wrote an software to manage files amongst directories and necessary a operate to create positive the directory structure was precisely the same involving the resource and location files. VBA delivers a operate described as MkDir that is used to create a directory, but it calls for that the mother or father directory already exists. Here's a perform called MkTree that may walk a route and set up each of the directories while in the tree to get a provided file/directory path.
' -------------------------------------------------------------------------- ' Function: MkTree ' Objective : Build directories for a presented file name ' Notes : MkTree "c:\a\b\c\file.txt" would create directories for c:\a\b\c ' MkTree "c:\a\b\c\" would construct c:\a\b\c ' MkTree "c:\a\b\c" would make c:\a\b ' -------------------------------------------------------------------------- Public Sub MkTree(ByVal strFile As String) ' walk the file and ensure that the paths exist Dim strRoot As String Dim strPath As String Dim pos As Integer ' get the root If (InStr(strFile,win 7 64bit key sale, ":\") = 2) Then strRoot = Left(strFile,buy office 2010 Standard, InStr(strFile,genuine microsoft office Pro Plus 2007, ":\") + 1) ElseIf (InStr(strFile, "\\") = 1) Then strRoot = Left(strFile, InStr(InStr(strFile, "\\") + 2, strFile, "\")) Else MsgBox "Invalid Root Directory", vbExclamation Exit Sub End If pos = InStr(Len(strRoot) + 1, strFile,microsoft office Pro 2007 serial key, "\") While (pos > 0) strPath = Left(strFile, pos) ' Build the directory On Error Resume Next MkDir strPath Debug.Assert Err = 0 Or Err = 75 On Error GoTo 0 pos = InStr(pos + 1, strFile,office Standard 32 bit, "\") Wend End Sub |
All times are GMT. The time now is 05:47 AM. |
Powered by vBulletin Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Free Advertising Forums | Free Advertising Message Boards | Post Free Ads Forum