AW: neue Version
04.07.2008 10:22:00
Erich
Hi Kurt und guten Morgen,
hier habe ich doch noch eine neue Version für dich:
Option Explicit
Private Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" _
(ByVal PFAD As String) As Long
Sub test2()
Dim strVz As String, zz As Long, strAV As String, strNV As String
zz = 17
strVz = Cells(zz, 1) & ":\"
If Dir(strVz, vbDirectory) = "" Then
MsgBox "Laufwerk falsch:" & vbLf & strVz, vbCritical
Exit Sub
End If
strAV = strVz
While Not IsEmpty(Cells(zz + 1, 1)) And zz "" Then
strAV = "Schon vorhanden war Verzeichnis:" & vbLf & strVz
Else
If MakeSureDirectoryPathExists(strVz) 1 Then
MsgBox "Nicht angelegt werden konnte Verzeichnis:" & vbLf & strVz, vbCritical
Exit Sub
ElseIf strNV = "" Then
strNV = _
"Neu angelegt wurde (evtl. mit Unterverzeichnissen)" & vbLf & strVz
End If
End If
Wend
MsgBox strAV & strNV, vbInformation
ActiveWorkbook.SaveAs strVz & Cells(32, 1) & ".xls"
End Sub
Klappt es so, wie du es möchtest?
Rückmeldung wäre nett! - Grüße von Erich aus Kamp-Lintfort