Lesen des makros
22.02.2006 09:48:32
Martin
ich bräuchte eine kleine Beschreibung zu einem Makro, so dass ich es ein wenig selbst verstehe, welche Befehle welche Aktionen bringen. Vielleicht kann mir ja einer helfen, danke schonmal!
Private Sub CommandButton1_Click()
Dim s_pfad(20)
SPfad = "D:\Save"
OPfad = ActiveWorkbook.Path
On Error Resume Next
opfad2 = Right(OPfad, Len(OPfad) - 3)
spfad2 = SPfad & "\" & opfad2
n = 0
For s = 1 To Len(spfad2)
If Mid(spfad2, s, 1) = "\" Then
s_pfad(n) = Left(spfad2, s - 1)
Debug.Print n, s_pfad(n)
n = n + 1
End If
Next s
s_pfad(n) = spfad2
oname = ActiveWorkbook.Name
On Error GoTo erstellen
For t = 1 To n
ChDir (s_pfad(t))
Next t
ActiveWorkbook.SaveCopyAs FileName:=spfad2 & "\" & oname
ActiveWorkbook.Save
Exit Sub
erstellen:
MkDir (s_pfad(t))
Resume Next
End Sub
Sub sf_ein()
Set SM = CommandBars.FindControl(Id:=3)
SM.OnAction = "Test"
End Sub
Sub sf_aus()
Set SM = CommandBars.FindControl(Id:=3)
SM.OnAction = ""
End Sub