HERBERS Excel-Forum - die Beispiele

Thema: Schriftart der Statusbar verändern

Home

Gruppe

API

Problem

Wie kann ich die Schriftart in der StatusBar verändern?

Lösung
Geben Sie den nachfolgenden Code in ein Standardmodul ein und weisen Sie ihn einer Schaltfläche zu.
StandardModule: basMain

Option Base 1
 Declare Function FindWindow32 Lib "user32" Alias "FindWindowA" _
  (ByVal szClass$, ByVal szTitle$) As Long
 Declare Function GetWindow32 Lib "user32" Alias "GetWindow" _
  (ByVal hwnd As Long, ByVal wCmd As Long) As Long
 Declare Function GetClassName32 Lib "user32" Alias "GetClassNameA" _
  (ByVal hwnd As Long, ByVal lpClassName As String, _
  ByVal nmaxCount As Long) As Long
 Declare Function GetDC32 Lib "user32" Alias "GetDC" _
  (ByVal hwnd As Long) As Long
 Declare Function CreateFont32 Lib "gdi32" Alias "CreateFontA" _
  (ByVal H As Long, ByVal w As Long, ByVal E As Long, _
  ByVal O As Long, ByVal w As Long, ByVal i As Long, _
  ByVal u As Long, ByVal s As Long, ByVal c As Long, _
  ByVal OP As Long, ByVal CP As Long, ByVal Q As Long, _
  ByVal PAF As Long, ByVal f As String) As Long
 Declare Function SelectObject32 Lib "gdi32" Alias "SelectObject" _
  (ByVal hdc As Long, ByVal hObject As Long) As Long
 Declare Function SetTextColor32 Lib "gdi32" Alias "SetTextColor" _
 (ByVal hdc As Long, ByVal crColor As Long) As Long
 Declare Function DeleteObject32 Lib "gdi32" Alias "DeleteObject" _
  (ByVal hObject As Long) As Long
 Declare Function ReleaseDC32 Lib "user32" Alias "ReleaseDC" _
  (ByVal hwnd As Long, ByVal hdc As Long) As Long

Sub MsgInBold()
 Dim hWndNext
 Dim hWndWks32 As Long
 Dim hDcWks32 As Long
 Dim hFont32 As Long, hFontOld32 As Long
 Dim sBuff As String * 255
 Dim a As Long

 Const GW_CHILD As Integer = 5
 Const GW_HWNDFIRST As Integer = 0
 Const GW_HWNDNEXT As Integer = 2

 Application.DisplayStatusBar = True

 'Get the handle of the Excel window
 hWndWks32 = FindWindow32("XLMAIN", Application.Caption)

 'Get a child window
 hWndNext = GetWindow32(hWndWks32, GW_CHILD)

 'Get the first child window
 hWndNext = GetWindow32(hWndNext, GW_HWNDFIRST)

 a = GetClassName32(hWndNext, sBuff, 255)
 hDcWks32 = GetDC32(hWndNext)

 'Create the font to use for the text
 'CreateFont(Height, Width, Escapement, Orientation, Weight, _
 '           Italic, Underline, Strikeout, CharSet, Precision, _
 '           Clipping, Quality, Pitch & Family, Font Name)
 '
 'Times New Roman, 32pt, Bold:
 '  CreateFont32(-32, 0, 0, 0, 700, 0, 0, 0, 0, 0, 0, 0, 0, _
   "Times NewRoman ")"
 '
 'MS Sans Serif, 12pt, Normal, Italic, Underline & Strikeout:
 '  CreateFont32(-12, 0, 0, 0, 400, 1, 1, 1, 0, 0, 0, 0, 0, _
   "MS SansSerif ")"

 hFont32 = CreateFont32(-32, 0, 0, 0, 700, 0, 0, 0, 0, 0, 0, 0, 0, _
   "Times New Roman")

 hFontOld32 = SelectObject32(hDcWks32, hFont32)

 'Display the message in the correct font
 Application.StatusBar = "Please press the OK button"

 'Display a message box
 MsgBox "How's that!"

 Application.StatusBar = False

 'Restore the original font
 a = SelectObject32(hDcWks32, hFontOld32)

 'Release the device context to the status bar
 a = ReleaseDC32(hWndNext, hDcWks32)

End Sub

Beiträge aus dem Excel-Forum zu den Themen API und Schrift

Excel to Word Kapitel VBA Anfangskapital berechnen
Gestapelte Säulen-Diagramm: Ich kapier's nicht Googel Maps API in Excel VBA einfügen
Datenbeschriftung Schriftgröße und -art im Kombinationsfeld
keine neuen Schriftarten Spaltenüberschrift unter Bedingung eintragen
Pivot-Tabelle mit NICHT sortierten Überschriften Odrner auslesen ;Arbeitsblätter "Beschriften"
aus Spalten kl. Wert wählen+ Überschrift ausgeben Fußzeile Schriftgröße
Überschriften zum Sortieren in Zeile 2 Grafik, Datenbeschriftung
Zeilen- und Spaltenüberschriften finden ListBox spaltenüberschriften
Array abhängig von Spaltenüberschriften erstellen Beschriftung X/Y Diagramm/ Blasendiagramm
Tabellenblattbeschriftungen übernehmen Berechnung vom Endkapital
Textbox Schriftgrösse ändern neue Schriftarten
Schriftart ändern Schriftart zuweisen
CheckBox Schrift ausrichtung Drucken mehrer seiten mit überschrift
Tabellenbeschriftung Beschriftungstext einer Schaltfläche an Prozedur
Datenmaske - Überschriften in Zeile 2 XY-Tabelle mit bestimmter achsenbeschriftung
UF unterschiedliche Schriftdarstellung MsgBox Schriftgröße
2 Schriftgrößen im Kommentar Zeilen kopieren in Blöcken mit Überschriften
API? - xl-Parameter aus Long-Wert bestimmen Beschriftung bei Bubble-Grafik
Berechnung Kapitalanlage Beschriftung Größenachse Plus/Minus ändern
Beschriftungsgröße bei Formatänderung beibeha Schriftart der Zeilen/Spaltenüberschriften
Symbolleiste,Spalten-Zeilenüberschrift ausblenden Schriftgrösse anpassen
Laufschrift (Tempo) in Userform Schrift in einer Tabelle ersetzen
Zeilen-Spaltenbeschriftung Abfrage auf Schrift
Schriftfarbe Telefonnummer auslesen per TAPI
Überschriften über Symbole weg Diagrammwerte beschriften