
Public Sub OggettoShape(x1 As Double, y1 As Double, x2 As Double, y2 As Double, testo As String)
ActiveSheet.Shapes.AddShape(msoShapeRectangle, X1,Y1,X2,Y2).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = testo
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 6). _
ParagraphFormat
.FirstLineIndent = 0
.Alignment = msoAlignLeft
End With
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 6).Font
.NameComplexScript = "+mn-cs"
.NameFarEast = "+mn-ea"
.Fill.Visible = msoTrue
.Fill.ForeColor.ObjectThemeColor = msoThemeColorLight1
.Fill.ForeColor.TintAndShade = 0
.Fill.ForeColor.Brightness = 0
.Fill.Transparency = 0
.Fill.Solid
.Size = 11
.Name = "+mn-lt"
End With
Range("A1").Select
End Sub
|
Public Sub OggettoShape()
Dim x1 As Double, y1 As Double, x2 As Double, y2 As Double, testo As String
x1 = 50
x2 = 50
y1 = 100
y2 = 100
testo = "Prova scrittura"
ActiveSheet.Shapes.AddShape(msoShapeRectangle, x1, y1, x2, y2).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = testo
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 6). _
ParagraphFormat
.FirstLineIndent = 0
.Alignment = msoAlignLeft
End With
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 6).Font
.NameComplexScript = "+mn-cs"
.NameFarEast = "+mn-ea"
.Fill.Visible = msoTrue
.Fill.ForeColor.ObjectThemeColor = msoThemeColorLight1
.Fill.ForeColor.TintAndShade = 0
.Fill.ForeColor.Brightness = 0
.Fill.Transparency = 0
.Fill.Solid
.Size = 11
.Name = "+mn-lt"
End With
Range("A1").Select
End Sub |
Public Sub OggettoShape(x1 As Double, y1 As Double, x2 As Double, y2 As Double, testo As String) |
Private Sub CommandButton1_Click()
a = InputBox("dammi il valore")
b = InputBox("dammi il valore")
c = InputBox("dammi il valore")
d = InputBox("dammi il valore")
f = InputBox("dammi il valore")
Call OggettoShape(a, b, c, d, f)
End Sub
In un modulo:
Public Sub OggettoShape(ByVal x1 As Double, ByVal y1 As Double, ByVal x2 As Double, ByVal y2 As Double, ByVal testo As String)
ActiveSheet.Shapes.AddShape(msoShapeRectangle, x1, y1, x2, y2).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = testo
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 6). _
ParagraphFormat
.FirstLineIndent = 0
.Alignment = msoAlignLeft
End With
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 6).Font
.NameComplexScript = "+mn-cs"
.NameFarEast = "+mn-ea"
.Fill.Visible = msoTrue
.Fill.ForeColor.ObjectThemeColor = msoThemeColorLight1
.Fill.ForeColor.TintAndShade = 0
'.Fill.ForeColor.Brightness = 0<<<===Commentato
.Fill.Transparency = 0
.Fill.Solid
.Size = 11
.Name = "+mn-lt"
End With
Range("A1").Select
End Sub
|
Public Sub OggettoShape(ByVal x1 As Double, ByVal y1 As Double, ByVal x2 As Double, ByVal y2 As Double, ByVal testo As String)
ActiveSheet.Shapes.AddShape(msoShapeRectangle, x1, y1, x2, y2).Select
Selection.Characters.Text = testo
With Selection.Characters(Start:=1, Length:=4).Font
.Name = "Arial"
.FontStyle = "Normale"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("P13").Select
End Sub
|
