soffice.exe macro:///Standard.Module1.Main
以下のサイトなどを参考
http://hermione.s41.xrea.com/pukiwiki/index.php?OOobbs2%2F4
以下は、マクロのサンプル
Sub Main
msgbox "hello"
Dim DatabaseContext As Object
Dim DataSource As Object
Dim Connection As Object
Dim Statement As Object
Dim ResultSet As Object
DatabaseContext = createUnoService("com.sun.star.sdb.DatabaseContext")
DataSource = DatabaseContext.getByName("kigyou")
Connection = DataSource.getConnection("", "")
Statement = Connection.createStatement()
ResultSet = Statement.executeQuery("select * from 連絡先")
If IsNull(ResultSet) Then
MsgBox "検索されたレコード件数が0件"
Else
While ResultSet.next
sValue1 = ResultSet.getString(1)
' sValue2 = ResultSet.getLong(2)
sValue2 = ResultSet.getString(2)
msgbox sValue1
msgbox sValue2
Wend
End If
Statement.Close()
Connection.Close()
Connection.Dispose()
msgbox "end"
End Sub
0 件のコメント:
コメントを投稿