Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Execute a Python Macro (Function) From Base and Return Value to Base

Is it possible to have a python script return a value to LibreOffice Basic function when executed from Base?

For Example- In Base I call the function below with: " If TableExists(strUSBTableName) Then ..."

Function TableExists(strTableName As String) As Boolean
    rem http://www.access2base.com/access2base.html
    Dim odbDatabase As Object    
    Set odbDatabase = Application.CurrentDb()         
    Dim i As Integer   
    docmd.runCommand("DBRefreshTables")            
        TableExists = False  
        With odbDatabase    
            For i = 0 To .TableDefs().Count - 1         
                If strTableName = .TableDefs(i).Name Then               
                    TableExists = True
                    Exit For
                End If
            Next i      
        End With    
        Exit Function
    End Function

Can a Python script be used in the code above instead of Basic? I suspect that it won't really be a direct substitution.

Function TableExists(strTableName As String) As Boolean
            *** Some python script in here ***
            *** Return Some Value to Base (basic) ***
 End Function

Execute a Python Macro (Function) From Base and Return Value to Base

Is it possible to have a python script return a value to LibreOffice Basic function when executed from Base? I am using Ubuntu 14.04 with LibreOffice 4.4.3.2.

For Example- In Base I call the function below with: " If TableExists(strUSBTableName) Then ..."

Function TableExists(strTableName As String) As Boolean
    rem http://www.access2base.com/access2base.html
    Dim odbDatabase As Object    
    Set odbDatabase = Application.CurrentDb()         
    Dim i As Integer   
    docmd.runCommand("DBRefreshTables")            
        TableExists = False  
        With odbDatabase    
            For i = 0 To .TableDefs().Count - 1         
                If strTableName = .TableDefs(i).Name Then               
                    TableExists = True
                    Exit For
                End If
            Next i      
        End With    
        Exit Function
    End Function

Can a Python script be used in the code above instead of Basic? I suspect that it won't really be a direct substitution.

Function TableExists(strTableName As String) As Boolean
            *** Some python script in here ***
            *** Return Some Value to Base (basic) ***
 End Function

Execute a Python Macro (Function) From Base and Return Value to Base

Is it possible to have a python script return a value to LibreOffice Basic function when executed from Base? I am using Ubuntu 14.04 with LibreOffice 4.4.3.2.

For Example- In Base I call the function below with: " If TableExists(strUSBTableName) Then ..."

Function TableExists(strTableName As String) As Boolean
    rem http://www.access2base.com/access2base.html
    Dim odbDatabase As Object    
    Set odbDatabase = Application.CurrentDb()         
    Dim i As Integer   
    docmd.runCommand("DBRefreshTables")            
        TableExists = False  
        With odbDatabase    
            For i = 0 To .TableDefs().Count - 1         
                If strTableName = .TableDefs(i).Name Then               
                    TableExists = True
                    Exit For
                End If
            Next i      
        End With    
        Exit Function
    End Function

Can a Python script be used in the code above instead of Basic? I suspect that it won't really be a direct substitution.

Function TableExists(strTableName As String) As Boolean
            *** Some python script in here ***
            *** Return Some Value to Base (basic) ***
 End Function