Autor Thema: per LotusScript ein Rechteck erstellen  (Gelesen 5966 mal)

Offline Micha8

  • Frischling
  • *
  • Beiträge: 24
per LotusScript ein Rechteck erstellen
« am: 26.06.08 - 09:00:48 »
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#

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

Offline Johnson

  • Senior Mitglied
  • ****
  • Beiträge: 258
  • Geschlecht: Männlich
Re: per LotusScript ein Rechteck erstellen
« Antwort #1 am: 01.07.08 - 11:57:05 »
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

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
Gruß
Johnson

Offline Micha8

  • Frischling
  • *
  • Beiträge: 24
Re: per LotusScript ein Rechteck erstellen
« Antwort #2 am: 07.07.08 - 11:05:32 »
Hallo Johnson,
habe den Code nun probiert, funktioniert wirklich SUPER !!!

Vielen Dank dafür.
Gruß
Michael

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz