AW: Schriftgröße in einer AutoForm anpassen
11.05.2009 15:23:20
Enrico
Hallo Sepp,
folgend der ganze Code... Nochmals vielen Dank für deine Unterstützung!!!
Option Explicit
Sub LOOPAnlageFixelObjekt()
Sheets("FIXEL").Select
Range("A2").Select
Do
Call AnlageFixelObjekt
ActiveCell.Offset(1, 0).Select
Loop Until IsEmpty(ActiveCell.Offset(0, 0))
End Sub
Public Sub AnlageFixelObjekt()
Dim Rechteck As MeinRechteckTyp
Rechteck.Höhe = ActiveCell.Offset(0, 15).Value
Rechteck.Oben = ActiveCell.Offset(0, 13).Value
Rechteck.Links = ActiveCell.Offset(0, 12).Value
Rechteck.Breite = ActiveCell.Offset(0, 16).Value
Set Rechteck.Element = ActiveSheet.Shapes.AddShape( _
msoShapeRectangle, Rechteck.Links, _
Rechteck.Oben, Rechteck.Breite, Rechteck.Höhe)
Rechteck.Element.Name = ActiveCell.Offset(0, 0)
Set Rechteck.Element = Nothing
Call test
End Sub
Sub test()
Dim textboxname As Object
sizeShape textboxname, 80, 60
End Sub
Sub sizeShape(TheShape As Shape, shpWidth As Double, shpHeight As Double)
Dim intFontSize As Integer
For intFontSize = 7 To 72
With TheShape
.TextFrame.Characters.Font.Size = intFontSize
.TextFrame.AutoSize = True
If .Width > shpWidth Or .Height > shpHeight Then
.TextFrame.Characters.Font.Size = intFontSize - 1
.TextFrame.AutoSize = False
.Width = shpWidth
.Height = shpHeight
Exit For
End If
End With
Next
End Sub
Gruß
Enrico