24.08.2008

Character font - Small - Large!

Over a key (F11 more largely - F12 smaller) the character font within the marked range is changed, between sizes 6 and 120.


The following code belonged in "ThisWorkbook"


Option Explicit
Private Sub Workbook_Open()
Application.OnKey "{F11}", "Module1.Large"
Application.OnKey "{F12}", "Module1.Small"
End Sub
Private Sub Workbook_Deactivate()
Application.OnKey "{F11}"
Application.OnKey "{F12}"
End Sub

The following code belonged In "Module1"

Option Explicit
Public Sub Large()
Dim bytWriting As Byte
On Error GoTo Large_Error
With Selection.Font
bytWriting = .Size
bytWriting = bytWriting + 1
If bytWriting > 120 Then Exit Sub
.Size = bytWriting
End With
On Error GoTo 0
Exit Sub
Large_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ")"
End Sub
Public Sub Small()
Dim bytWriting As Byte
On Error GoTo Small_Error
With Selection.Font
bytWriting = .Size
bytWriting = bytWriting - 1
If bytWriting < 6 Then Exit Sub
.Size = bytWriting
End With
On Error GoTo 0
Exit Sub
Small_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ")"
End Sub


Sample 2003

Sample 2007

Keine Kommentare:

Kommentar veröffentlichen

Word - Kontrollkästchen (Formularsteuerelement) auslesen...

Aus allen Worddateien sollen die Kontrollkästchen (Formularsteuerelement) ausgelesen werden - Haken gesetzt oder nicht. Auch ein Textfeld (F...