Hi Matthias,

this works for me (calc):

Oliver

--

REM  *****  BASIC  *****

OPTION EXPLICIT

Sub Main

        On Local Error Goto ErrorHandler
        
        Dim oDocument as Object
        Dim oSheet as Object
        Dim oPStyle as Object
        Dim oCpyStyle as Object
        Dim aProperties as Object
        Dim vTmp as Variant
        Dim sCopy as String
        Dim sX as String
        Dim i as Integer
        
        oDocument = ThisComponent
        sCopy = "NewStyle"
        
        oPStyle = oDocument.StyleFamilies.getByName("PageStyles")
        oCpyStyle = oDocument.createInstance("com.sun.star.style.PageStyle")

        If oPStyle.hasByName(sCopy) Then
                oPStyle.removeByName(sCopy)
        EndIf

        oPStyle.insertByName(sCopy, oCpyStyle)
        oPStyle = oPStyle.getByName("Default")

        aProperties = oPStyle.PropertySetInfo.Properties

        For i = LBound(aProperties) to UBound(aProperties)
                sX = aProperties(i).Name
                If oPStyle.getPropertyState(sX) = 
com.sun.star.beans.PropertyState.DIRECT_VALUE Then
                        vTmp = oPStyle.getPropertyValue(sX)
                        oCpyStyle.setPropertyValue(sX, vTmp)
                EndIf
        Next i

        Exit Sub
ErrorHandler:
        MsgBox sX
        Resume Next

End Sub

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to