Option
Explicit
Private
Declare
Function
MakeSureDirectoryPathExists
Lib
"imagehlp.dll"
( _
ByVal
DirPath
As
String
)
As
Long
Public
Sub
test()
Const
SOURCE_PATH
As
String
=
"C:\Users\xyz\Test"
Const
TARGET_PATH
As
String
= "C:\Users\xyz\TestNeu\"
If
CBool
(MakeSureDirectoryPathExists(TARGET_PATH))
And
_
Dir$(PathName:=SOURCE_PATH, Attributes:=vbDirectory) <> vbNullString
Then
Name SOURCE_PATH
As
TARGET_PATH &
"Gesamt"
Else
Call
MsgBox(Prompt:=
"Der Ordner konnte nicht erstellt werden, oder Datei wurde nicht gefunden..."
, _
Buttons:=vbExclamation, Title:=
"Error"
)
End
If
End
Sub