Beates Add-Inn erstellt Symbolleiste, wie?
02.08.2008 12:19:53
Reinhard
Beate hat hier:
https://www.herber.de/forum/archiv/540to544/t543914.htm#543914
ein Add-In erstellt (xla) erstellt, daß man hier runterladen kann:
http://users.quick-line.ch/ramel/Files/Spalte-Zeile_in_cm.XLA
Es funktioniert auch gut.
Nur ich verstehe absolut nicht wo da der Code versteckt ist, der die neue Symbolleiste "Spalte-Zeile" erstellt und ihren zwei Schaltflächen die Makros zuweist.
Im Code der xla ist nur der nachstehende Code sichtbar.
Die Symbolleiste wird auch erstellt wenn man mit deaktivierten Makros die xla öffnet.
Wie kann sie das gemacht haben?
Danke ^ Gruß
Reinhard
In Diese Arbeitsmappe:
Option Explicit Private Sub Workbook_AddinInstall() Application.CommandBars("Spalte-Zeile").Visible = True End Sub Private Sub Workbook_AddinUninstall() Application.CommandBars("Spalte-Zeile").Visible = False End Sub
in Modul1:
Option Explicit
Sub Spaltenbreite()
'Grundlagen im folgenden KB-Artikel:
'http://support. _
microsoft.com/default.aspx?scid=kb;de;504562
Dim sBreite As Single
Dim sAktuell As Single
Dim strAktuell As String
Dim strText As String
Dim strCaption As String
Dim strAntwort As String
Dim sExcelSizeFaktor As Single
sExcelSizeFaktor = Application.StandardFontSize / 10
On Error Resume Next
sAktuell = (Selection.ColumnWidth + 0.71) / 5.1425 * sExcelSizeFaktor
' wenn unterschiedlich breite Spalten ausgewählt werden:
If Err.Number 0 Then
Err.Clear
sAktuell = (ActiveCell.ColumnWidth + 0.71) / 5.1425 * sExcelSizeFaktor
End If
On Error GoTo 0
strAktuell = Format(sAktuell, "###0.00")
strText = "Aktuelle Spaltenbreite: " & strAktuell & " cm." & vbLf _
& "Geben Sie die gewünschte Spaltenbreite für die " _
& "aktuelle Spalte oder Markierung in cm ein:"
strCaption = "Neue Spaltenbreite festlegen "
strAntwort = Excel.Application.InputBox(strText, strCaption, strAktuell, , , , , 1)
If strAntwort Then
sBreite = (-0.71 + 5.1425 * CSng(strAntwort) / sExcelSizeFaktor)
If sBreite >= 0 And sBreite 'http://support. _
microsoft.com/default.aspx?scid=kb;de;504562
Dim sHoehe As Single
Dim sAktuell As Single
Dim strAktuell As String
Dim strText As String
Dim strCaption As String
Dim strAntwort As String
Dim sExcelSizeFaktor As Single
sExcelSizeFaktor = Application.StandardFontSize / 10
On Error Resume Next
sAktuell = Selection.RowHeight / 29.5
' wenn unterschiedlich hohe Zeilen ausgewählt werden:
If Err.Number 0 Then
Err.Clear
sAktuell = ActiveCell.RowHeight / 29.5
End If
On Error GoTo 0
strAktuell = Format(sAktuell, "###0.00")
strText = "Aktuelle Zeilenhöhe: " & strAktuell & " cm." & vbLf _
& "Geben Sie die gewünschte Zeilenhöhe für die " _
& "aktuelle Zeile oder Markierung in cm ein:"
strCaption = "Neue Zeilenhöhe festlegen"
strAntwort = Excel.Application.InputBox(strText, strCaption, strAktuell, , , , , 1)
If strAntwort Then
sHoehe = CSng(strAntwort) * 29.5
If sHoehe >= 0 And sHoehe "" Then
sBreite = CSng(strAntwort)
Selection.ColumnWidth = -0.71 + 5.1425 * sBreite
End If
End Sub