Trying to figure out to create a Macro in LO 26.2 under Ubuntu that accesses a Query, based in a Split HSQL DataBase.
The Query is used for creating a csv-format file that is to imported in an external MS program, that runs on a separate computer.
The program requires a certain file layout, hence this process.
The Query is now run manually, by doing the following:
1. Open a Calc Sheet
2. Ctrl+Shift+F4 (Data Sources)
3. Select and run Query.
Note: the Query requires User input.
I came to this point
Opening an existing document called: DataSources.ods.
NOTE: Would like to not do it this way. I would like to use a User Input for the Document Name, instead of 'fixed'.
Code: Select all
Sub NewOds
Dim docURL As String
Dim doc As Object, docProperties()
docURL = ConvertToURL("/home/.../Documents/DataSource.ods")
Rem com.sun.star.frame.Desktop
doc = StarDesktop.LoadComponentFromURL(docURL, "_blank", 0, docProperties)
End Sub
Should not be that complex for sure.
Code: Select all
sub OpenSource
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ViewDataSourceBrowser"
args1(0).Value = true
dispatcher.executeDispatch(document, ".uno:ViewDataSourceBrowser", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "ViewDataSourceBrowser"
args2(0).Value = true
dispatcher.executeDispatch(document, ".uno:ViewDataSourceBrowser", "", 0, args2())
end Sub
What I not want to do is copy the Query in to the Macro, but call it by name.
Some guidance is appreciated.
Dream
PS: I am learning to understand......