Relatorio
REM Macro semelhante ao AutoExec do ACCESS Sub AutoExec On Error Goto HandleError Dim LastFrame As Object Dim NumFrames As Integer Static FormDocs As Object Dim DBDoc As Object Dim ImpName As String Dim DataSource As Object Dim Conn As Object Dim Args(1) As New com.sun.star.beans.PropertyValue Dim FormName As String Dim FormDoc As Object FormName="SWITCHBOARD" 'Mude aqui para o Forms de Abertura da Aplicação ImpName="com.sun.star.comp.dba.ODatabaseDocument" NumFrames=StarDesktop.Frames.Count LastFrame=StarDesktop.Frames.getByIndex(NumFrames-1) If LastFrame.Frames.Count>1 Then Exit Sub End If If Not (LastFrame.Controller.Model.ImplementationName=ImpName) Then Exit Sub REM not a db doc End If DataSource=LastFrame.Controller.DataSource DBDoc=DataSource.DatabaseDocument FormDocs=DBDoc.FormDocuments Conn=DataSource.getConnection("","") REM no user/password Args(0).Name="ActiveConnection" : Args(0).Value=Conn if FormDocs.hasByName(FormName)