Hallo Volker,

vielen Dank, ich habe es hingekriegt.

Und noch danke an Alle, die gepostet haben.

viele Gruesse

Martin

[email protected]

Volker Heggemann schrieb:
Sorry, ich hatte die eigendliche Funktion vergessen anzuhängen!
Jetzt noch mal alles Komplett - geht sogar mit Copy & Paste:

*********************

Sub SetValue

Dim oDoc As Object, oSheet As Object, oCell As Object

   oDoc=ThisComponent

   oSheet=oDoc.Sheets.getByName("Tabelle1")

   oCell=oSheet.getCellByPosition(0,0) 'A1

   oCell.setValue(23658)


   oCell.NumberFormat = FindCreateNumberFormatStyle("00.000,00", odoc)

'hier kann der unten aufgeführte Code für ein eigenes Zahlenformat rein

   'oCell.NumberFormat=2 '23658.00

   'oCell.SetString("oops")

   'oCell.setFormula("=FUNCTION()")

   'oCell.IsCellBackgroundTransparent = TRUE

   'oCell.CellBackColor = RGB(255,141,56)

End Sub


Function FindCreateNumberFormatStyle(ByVal sFormat As String,doc As Object) As Long
   Dim aLocale As New com.sun.star.lang.Locale
   Dim oFormats As Object
   Set oFormats = doc.getNumberFormats()
   Dim formatNum As Long
   formatNum = oFormats.queryKey(sFormat, aLocale, True)
   If (formatNum = -1) Then
       formatNum = oFormats.addNew(sFormat, aLocale)
       If (formatNum = -1) Then formatNum = 0
   End If
   FindCreateNumberFormatStyle = formatNum
End Function
************************

So , das ist dann auch getestet!

mfg
Volker

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Antwort per Email an