Ejemplo de ActiveX Automation (Windows)
Private Sub Form_Load()

'----------------------------------------------
' Código de ejemplo para acceder a FileMaker Pro
' en Visual Basic.
'
' "Debe comprobarse FileMaker Pro 7.0 Type Library"
' y estar disponible en Visual Basic's Project/References.
'----------------------------------------------
 
'----------------------------------------------
' Declarar objetos e iniciar FileMaker
'----------------------------------------------
 
' Declarar variables de objeto
Dim FMApp As FMPro70Lib.Application
Dim FMDocs As FMPro70Lib.Documents
Dim FMActiveDoc As FMPro70Lib.Document
' Iniciar FileMaker
Set FMApp = CreateObject("FMPRO.Application")
 
' Configurar el objeto Documents
Set FMDocs = FMApp.Documents
 
' Hacer visible FileMaker (cuando se inicia desde Automation,
' FileMaker sigue oculto de forma predeterminada.)
FMApp.Visible = True
 
'----------------------------------------------
' Consultar documentos abiertos
'----------------------------------------------
 
'Comprobar el recuento de documentos abiertos
If FMDocs.Count = 0 Then
Debug.Print "Ningún documento abierto"
Else
Debug.Print "El recuento de documentos abiertos es:"; FMDocs.Count
End If
 
'--------------------------------------------------
' Abrir una base de datos FileMaker y ejecutar un guión
'--------------------------------------------------
 
' Nota: Debe estar disponible un archivo de FileMaker "c:\testing.fp7"
' con un guión llamado "Primer guión" para que funcione
' el siguiente.
Dim myOpenFile As Object ' nota: también se puede declarar como
FMPro70Lib.Document
 
Set myOpenFile = FMDocs.Open("c:\testing.fp7", "","")
myOpenFile.DoFMScript ("Primer guión")
 
'--------------------------------------------------
' Consultar el documento activo
'--------------------------------------------------
 
Set FMActiveDoc = FMDocs.Active
 
' Mostrar el nombre del documento activo
Debug.Print "El archivo activo es .."; FMActiveDoc.FullName
 
'--------------------------------------------------
' Enumerar y cerrar documentos
'--------------------------------------------------
 
Dim TempToc As Object
 
If FMDocs.Count > 0 Then
 
For Each TempDoc In FMDocs
Debug.Print "Acerca de cerrar documentos: "; TempDoc.FullName
TempDoc.Close
Set TempDoc = Nothing
Next
End If
'----------------------------------------------
' Borrar y salir
'----------------------------------------------
Set FMDocs = Nothing
Set FMActiveDoc = Nothing
Set myOpenFile = Nothing
 
' Salir de FileMaker y liberar las variables
' (Nota: después de salir, asigne siempre a la variable de aplicación el valor Nothing.)
FMApp.Quit
Set FMApp = Nothing
End Sub
Temas relacionados 
FileMaker Pro ActiveX Automation (Windows)
Objetos, métodos y propiedades de ActiveX Automation (Windows)