Anhand der aktiven Zelle wird ein Ordner inkl. Unterordner im Explorer erstellt.
Wie kann ich Word- und Excel Dateien und Vorlagen in die neuen Ordner speichern.
' **********************************************************************
' Modul: Modul1 Typ: Allgemeines Modul
' **********************************************************************
Option Explicit
Private Declare
Function MakeSureDirectoryPathExists Lib "imagehlp.dll" ( _
ByVal DirPath As String) As Long
Sub makeDir()
Dim strPath As String, strInitialPath As String
Dim res As Long, intI As Integer
Dim varSF() As Variant
strInitialPath = "F:\Temp" 'Stammverzeichnis - anpassen!
strPath = ActiveCell
If Trim(strPath) = "" Then Exit Sub
varSF = Array("Finanzen", "AVOR", "Korrespondenz", "Diverses") 'Unterordner
If Right(strPath, 1) "\" Then strPath = strPath & "\"
If Right(strInitialPath, 1) "\" Then strInitialPath = strInitialPath & "\"
res = MakeSureDirectoryPathExists(strInitialPath & strPath)
If res 0 Then
For intI = 0 To UBound(varSF)
MakeSureDirectoryPathExists (strInitialPath & strPath & varSF(intI) & "\")
Next
Else
MsgBox "Verzeichnis konnte nicht erstellt werden!", vbInformation, "Fehler"
End If
End Sub