CustomDocumentProperties Wert verschwindet
08.12.2006 14:38:13
Reinhard
die Datei:
Die Datei https://www.herber.de/bbs/user/38832.xls wurde aus Datenschutzgründen gelöscht
hat nachfolgenden Code. Problem machen die beiden CustomDocumentProperties
"Zeile" und "Spalte", beim Initialisieren der UF sind beide auf 1 gesetzt obwohl sie beim Beenden der Userform andere Werte haben.
Mich irritiert, dass es bei dem CustomDocumentPropertie "Zoomfaktor" problemlos funktioniert.
Unten ist ein Bild der UF, vielleicht wird es damit einfacher mich zu verstehen,
Die "91" in der oberen Textbox (txtZoom) bleibt erhalten wenn ich die UF beende und neu starte, die "G7" sind beim Neustart weg, es steht dann "A1".
Ich habe schon aus Verzweiflung mit Cint und Cstr herumexperimentiert, half aber nicht.
kann mir jmd sagen was zu tun ist?
Danke ^ Gruß
Reinhard
Option Explicit
Private Sub spinSpalte_Change()
ThisWorkbook.CustomDocumentProperties("Spalte").Value = spinSpalte.Value
txtZelle.Value = Cells(ThisWorkbook.CustomDocumentProperties("Zeile").Value, ThisWorkbook.CustomDocumentProperties("Spalte").Value).Address(0, 0)
End Sub
Private Sub spinZeile_Change()
ThisWorkbook.CustomDocumentProperties("Zeile").Value = spinZeile.Value
txtZelle.Value = Cells(ThisWorkbook.CustomDocumentProperties("Zeile").Value, ThisWorkbook.CustomDocumentProperties("Spalte").Value).Address(0, 0)
End Sub
Private Sub spinZoom_Change()
txtZoom = spinZoom
End Sub
Private Sub UserForm_Initialize()
spinZoom.Max = 200
spinZoom.Min = 10
spinZoom.Value = ThisWorkbook.CustomDocumentProperties("Zoomfaktor").Value
txtZoom.Value = ThisWorkbook.CustomDocumentProperties("Zoomfaktor").Value
spinSpalte.Max = ActiveSheet.UsedRange.Columns.Count - 1 + ActiveSheet.UsedRange.Cells(1, 1).Column
spinSpalte.Min = ActiveSheet.UsedRange.Cells(1, 1).Column
spinSpalte.Value = ThisWorkbook.CustomDocumentProperties("Spalte").Value
spinZeile.Max = ActiveSheet.UsedRange.Rows.Count - 1 + ActiveSheet.UsedRange.Cells(1, 1).Row
spinZeile.Min = ActiveSheet.UsedRange.Cells(1, 1).Row
spinZeile.Value = ThisWorkbook.CustomDocumentProperties("Zeile").Value
MsgBox ThisWorkbook.CustomDocumentProperties("Zoomfaktor").Value
MsgBox ThisWorkbook.CustomDocumentProperties("Zeile").Value
MsgBox ThisWorkbook.CustomDocumentProperties("Spalte").Value
txtZelle.Value = Cells(ThisWorkbook.CustomDocumentProperties("Zeile").Value, ThisWorkbook.CustomDocumentProperties("Spalte").Value).Address(0, 0)
End Sub
Private Sub UserForm_Terminate()
ThisWorkbook.CustomDocumentProperties("Zoomfaktor").Value = txtZoom.Value
ThisWorkbook.CustomDocumentProperties("Spalte").Value = spinSpalte.Value
ThisWorkbook.CustomDocumentProperties("Zeile").Value = spinZeile.Value
MsgBox TypeName(txtZoom.Value) 'String
MsgBox TypeName(spinSpalte.Value) 'long
MsgBox ThisWorkbook.CustomDocumentProperties("Zoomfaktor").Value
MsgBox ThisWorkbook.CustomDocumentProperties("Spalte").Value
MsgBox ThisWorkbook.CustomDocumentProperties("Zeile").Value
End Sub