Something I am failing to see is that the call to a sub in Standard is failing with Object Variable Not Set. I can't figure out which one is not set.
I would have liked to have this working as there are a number of reports, charts, etc., produced for the benefit of end users to get a glance at the accounts without having to know about databases etc.
My aim was to have a generalised save routine which stashes all the recent output in an easy to figure out directory structure. But for some reason, although this has been working, I have now made it not work and it is not clear what is wrong.
I will have to workround at the moment by pasting the code in each report macro but as is well known that does not make for a maintainable system. So any idea of what I am doing wrong will be very welcome.
Code: Select all
Sub Main (sysPath as string)
GlobalScope.BasicLibraries.loadLibrary("Standard")
select case sysPath
case "LIVE", "TEST", "UPGRADES"
rem nothing here
case else
print "System Path (" & sysPath & ") Won't Work"
exit sub
end select
basicLibrary = "reports"
basicModule = "bankStatements"
systemInstance = sysPath
Dim s$ : s = "private:factory/swriter"
oDoc = StarDesktop.loadComponentFromURL(s,"_blank",0,Array())
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
connectToDatabase (systemInstance, "Open Office", "123456")
SetPageSize
SetTabStops
doc=thisComponent
cursor=doc.text.createTextCursor
cursor.gotoEnd(False)
PopulateBanner
printBankAccountStatement
print systemInstance & " " & basicLibrary & " " & basicModule
rem call closeAsReadOnly.Main(thisComponent, controller, systemInstance, basicLibrary, basicModule)
rem v
call Standard.saveAndClose.Main(doc, systemInstance, basicLibrary, basicModule)
rem call Standard.saveAndClose.Main(systemInstance, basicLibrary, basicModule)
rem saveAndClose
End Sub
I do have xray installed but have not really got into how it can help diagnosis. Maybe a debug tool of a simpler type is available. I do have MRI installed but it's broken and I will need to reinstall OpenOffice which is a long way down my list of necessaries..