Tabelle SPEICHERN
15.01.2004 12:29:13
Giuseppe
ich habe ein Problem, die ich nicht lösen kann:
Ich möchte eine Tabelle speichern und benutze dafür der Code:
Private Sub Plan_Speichern()
Dim sPath As String
Dim s As String
s = "Plan " & Format(Range("B5"), "MMMM YYYY")
Label3.Caption = " Der " & s & " wurde gespeichert"
sPath = "C:\MY PLAN\Dienstpläne\"
'Application.Calculation = xlCalculationManual
ActiveSheet.Copy
ActiveSheet.Name = s
Application.DisplayAlerts = False
ActiveWorkbook.PrecisionAsDisplayed = False
ActiveWorkbook.UpdateLinks = xlUpdateLinksNever
ActiveWorkbook.SaveAs sPath & s
ActiveWorkbook.Close SaveChanges:=True
With Application
.DisplayAlerts = True
'.Calculation = xlCalculationAutomatic
End With
ActiveWorkbook.PrecisionAsDisplayed = True
Einblenden
Unload Me
End Sub
Jeder Tabelle die ich speichern will, hat ein VBA-Code die natürlich mitgespeichert wird:
Option Explicit
Private Sub Worksheet_Activate()
CommandBars("MY PLAN Monate").Controls(9).State = msoButtonDown = True
End Sub
Private Sub Worksheet_Deactivate()
CommandBars("MY PLAN Monate").Controls(9).State = msoButtonDown = False
End Sub
Private Sub Worksheet_Calculate()
'Code von Hajo
Dim index1 As Integer
With ActiveSheet
For index1 = 1 To 31
UserForm6.Controls("TextBox" & CStr(index1)) = .Cells(53, index1 + 3)
UserForm6.Controls("TextBox" & CStr(index1 + 31)) = .Cells(54, index1 + 3)
UserForm6.Controls("TextBox" & CStr(index1 + 62)) = .Cells(55, index1 + 3)
UserForm6.Controls("TextBox" & CStr(index1 + 93)) = .Cells(56, index1 + 3)
UserForm6.Controls("TextBox" & CStr(index1 + 124)) = .Cells(57, index1 + 3)
UserForm6.Controls("TextBox" & CStr(index1 + 155)) = .Cells(58, index1 + 3)
UserForm6.Controls("TextBox" & CStr(index1 + 186)) = .Cells(59, index1 + 3)
Next
End With
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel As Boolean)
UserForm4.Show
End Sub
Das speichern scheitert am der Code:
Private Sub Worksheet_Calculate()
Userform6 ist markiert: Fehler beim Kompilieren: Sub o. Funktionen nicht definiert( ist klar!! in der neue Mappe ist kein Userform 6!!!!).
Meine Frage: Wie kann ich beim Speichern der Code aus der Tabelle löschen?
Danke im Voraus für eure Hilfe
Giuseppe