Hola Carlos,

Carlos Cantelar escribió:
Hola a todos,

TEngo una hoja de Calculo que se creó con Microsoft Excel, esta hoja contiene un boton que realiza una funcion muy sencilla, poner una celda determinada en negrita. no he conseguido ver cual es la función equivalente en OO Basic. Adjunto la función

muy simple: una celda soporta el servico com.sun.star.style.CharacterProperties http://api.openoffice.org/docs/common/ref/com/sun/star/style/CharacterProperties.html con la propiedad *CharWeight* http://api.openoffice.org/docs/common/ref/com/sun/star/style/CharacterProperties.html#CharWeight

El valor de esa propiedad toma una de las constantes com.sun.star.awt.FontWeight http://api.openoffice.org/docs/common/ref/com/sun/star/awt/FontWeight.html


Un simple ejemplo:

Sub Demo_Cell_CharWeight

        Dim oDoc as Object
        'acceder al modelo del documento
        oDoc = ThisComponent
        
        Dim oSheets as Object
        'acceder a la collección de hojas
        oSheets = oDoc.getSheets()
        
        Dim oSheet as Object
        'acceder a la primer hoja por ínidce
        oSheet = oSheets.getByIndex(0)
        'acceder por su nombre
        'oSheet = oSheets.getByName("Sheet1")
        
        Dim oCell as Object
        'acceder a la celda en la columna B, fila 4
        oCell = oSheet.getCellByPosition(1,3)
        
        oCell.setFormula("Hola mundo!")
        
        'descarga Xray, para inspeccionar el objecto
        'xray oCell
        
        'cambiar la propiedad CharWeight
        oCell.CharWeight = com.sun.star.awt.FontWeight.BOLD
        
End Sub


Con este ejemplo no deberías tener problemas en adaptar tu VB macro:
Private Sub CommandButton3_Click()
For y = 4 To 15
    Worksheets("Gastos Mensuales").Cells(y, 11).Font.FontStyle = "normal"
Next
For y = 4 To 15
        If Month(Date) = Worksheets("Gastos Mensuales").Cells(y, 7) Then
           Worksheets("Gastos Mensuales").Cells(y, 11).Font.FontStyle = "Bold"
        End If
Next
End Sub

El problema parece que radica en la función FontStyle y no encuentro su 
equivalente.

en VB FontStyle es una propiedad, no una función http://msdn.microsoft.com/en-us/library/aa141759(office.10).aspx

Agradezco cualquier ayuda.
Saludos.


Saludos
Ariel.


--
Ariel Constenla-Haile
La Plata, Argentina

[EMAIL PROTECTED]
[EMAIL PROTECTED]

http://www.ArielConstenlaHaile.com.ar/ooo/



"Aus der Kriegsschule des Lebens
                - Was mich nicht umbringt,
        macht mich härter."
                Nietzsche Götzendämmerung, Sprüche und Pfeile, 8.

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

Responder a