Lotus Notes / Domino Sonstiges > OLE/COM-Programmierung

per LotusScript ein Rechteck erstellen

(1/1)

Micha8:
Hallo,
mittlerweile habe ich schon so einige Excel-Exporte programmiert, in denen meine Daten aus Notes schön in eine Exceltabelle exportiert werden. Nun fehlt mir noch das Tüpfelchen auf dem i. Ich möchte schließlich noch eine Autoform, und zwar ein Rechteck zeichnen. Den Makro Code aus Excel habe ich mir schon angeschaut, aber ich bekomme es einfach nicht auf LotusScript umgeswitcht. Es scheitert gleich an der ersten Zeile.

Hier der EXCEL-Makro-Code:


--- Code: ---    ActiveSheet.Shapes.AddShape(msoShapeRectangle, 1.5, 10.5, 80.25, 9.75). _
        Select
    Selection.ShapeRange.Fill.Transparency = 0#
    Selection.ShapeRange.Line.Weight = 0.75
    Selection.ShapeRange.Line.DashStyle = msoLineSolid
    Selection.ShapeRange.Line.Style = msoLineSingle
    Selection.ShapeRange.Line.Transparency = 0#
    Selection.ShapeRange.Line.Visible = msoFalse
    Selection.ShapeRange.Fill.Visible = msoTrue
    Selection.ShapeRange.Fill.ForeColor.RGB = RGB(0, 51, 102)
    Selection.ShapeRange.Fill.OneColorGradient msoGradientVertical, 4, 0.91
    Selection.ShapeRange.LockAspectRatio = msoFalse
    Selection.ShapeRange.Height = 8.25
    Selection.ShapeRange.Width = 1015.5
    Selection.ShapeRange.Rotation = 0#
--- Ende Code ---

Kann jemand sagen wie man das anstellt ?
Danke und Gruß
Michael

Johnson:
Ich hab unter LN 6.5.4 und Microsoft Excel 2002 SP3 folgendes zum Laufen gebracht


--- Code: ---Sub Initialize

Dim xl_app As Variant
Dim xl_book As Variant
Dim xl_sheet As Variant
Dim xl_shape As Variant

Const msoGradientVertical = 2
Const msoTrue = -1
Const msoFalse = 0
Const msoLineSingle = 1
Const msoLineSolid = 1
Const msoShapeRectangle = 1

Set xl_app = CreateObject("Excel.Application")
xl_app.Visible = True
Set xl_book = xl_app.Workbooks.Add
Set xl_sheet = xl_book.ActiveSheet

Set xl_shape = xl_sheet.Shapes.AddShape(msoShapeRectangle, 1.5, 10.5, 80.25, 9.75)
xl_shape.Fill.Transparency = 0#
xl_shape.Line.Weight = 0.75
xl_shape.Line.DashStyle = msoLineSolid
xl_shape.Line.Style = msoLineSingle
xl_shape.Line.Transparency = 0#
xl_shape.Line.Visible = msoFalse
xl_shape.Fill.Visible = msoTrue
xl_shape.Fill.ForeColor.RGB = RGB(0, 51, 102)
xl_shape.Fill.OneColorGradient msoGradientVertical, 4, 0.91
xl_shape.LockAspectRatio = msoFalse
xl_shape.Height = 8.25
xl_shape.Width = 1015.5
xl_shape.Rotation = 0#

End Sub

Function RGB(lng_red As Long, lng_green As Long, lng_blue As Long) As Long

If lng_red > 255 Then lng_red = 255
If lng_green > 255 Then lng_green = 255
If lng_blue > 255 Then lng_blue = 255
RGB= Clng(lng_red + (lng_green*256) + (lng_blue * 65536))

End Function
--- Ende Code ---

Was genau dein Fehler war, weiß ich nicht, da du die Fehlermeldung nicht beschrieben hast.
Aber ich hoffe, der Code oben hilft dir weiter.

Gruß
Johnson

Micha8:
Hallo Johnson,
habe den Code nun probiert, funktioniert wirklich SUPER !!!

Vielen Dank dafür.
Gruß
Michael

Navigation

[0] Themen-Index

Zur normalen Ansicht wechseln