Free Advertising Forums | Free Advertising Board | Post Free Ads Forum | Free Advertising Forums Directory | Best Free Advertising Methods | Advertising Forums

Free Advertising Forums | Free Advertising Board | Post Free Ads Forum | Free Advertising Forums Directory | Best Free Advertising Methods | Advertising Forums (http://www.freeadvertisingzone.com/index.php)
-   FFA's and FFA Blasters Directory (http://www.freeadvertisingzone.com/forumdisplay.php?f=62)
-   -   Office 2010 Serial Key MkTree Function - Make sure (http://www.freeadvertisingzone.com/showthread.php?t=1208690)

englishg9o 05-16-2011 03:40 PM

Office 2010 Serial Key MkTree Function - Make sure
 
Recently, I wrote an application to manage files between directories and needed a function to make sure that the directory structure was the same between the source and destination files. VBA provides a function called MkDir which is used to create a directory, but it requires that the parent directory already exists. Here's a function called MkTree that will walk a path and create all of the directories in the tree for a given file/directory path.
' --------------------------------------------------------------------------
' Function: MkTree
' Purpose : Create directories for a given file name
' Notes : MkTree "c:\a\b\c\file.txt" would create directories for c:\a\b\c
' MkTree "c:\a\b\c\" would create c:\a\b\c
' MkTree "c:\a\b\c" would create c:\a\b
' --------------------------------------------------------------------------
Public Sub MkTree(ByVal strFile As String)
' walk the file and make sure the paths exist
Dim strRoot As String
Dim strPath As String
Dim pos As Integer
' get the root
If (InStr(strFile,Windows 7 Home Basic 64, ":\") = 2) Then
strRoot = Left(strFile, InStr(strFile, ":\") + 1)
ElseIf (InStr(strFile, "\\") = 1) Then
strRoot = Left(strFile, InStr(InStr(strFile, "\\") + 2, strFile, "\"))
Else
MsgBox "Invalid Root Directory",Office Home And Business 2010 Key, vbExclamation
Exit Sub
End If
pos = InStr(Len(strRoot) + 1, strFile,Office 2010 Serial Key, "\")
While (pos > 0)
strPath = Left(strFile, pos)
' Create the directory
On Error Resume Next
MkDir strPath
Debug.Assert Err = 0 Or Err = 75
On Error GoTo 0
pos = InStr(pos + 1,Windows 7 Starter Key, strFile,Office Ultimate 2007, "\")
Wend
End Sub <div


All times are GMT. The time now is 01:44 PM.

Powered by vBulletin Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Free Advertising Forums | Free Advertising Message Boards | Post Free Ads Forum