Version: 24.2.7.2 (X86_64) / LibreOffice Community
Build ID: 420(Build:2)
CPU threads: 16; OS: Linux 6.17; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Ubuntu package version: 4:24.2.7-0ubuntu0.24.04.4
Calc: threaded
i have a sub that calls a function (both private). What im passing to the function is about 12 objects( WS, Ranges. rows, etc). of the sake of readability, the thought occurred to me as passing them a single object. So i created a 'GLOBAL TYPE ’ factoring in all the required objects. Seems to work until it hits the function. The TYPE variable is set to nothing originally. The function is where the TYPE objects are populated/written to. I vaguely recall reading ‘as of version 3, this wasn’t permitted’.
the full code is rather lengthy but…
on Open event triggers this…
Global type gtyStdWSObjs
** oThisWS as object**
** oThisUsedWS as object **
** oThisUsedWSRngAddr as com.sun.star.table.cellrangeaddress **
** oThisWSHdr as object**
** oThisWSHdrRngAddr as com.sun.star.table.cellrangeaddress**
** oThisWSBdy as object**
** oThisWSBdyRngAddr as com.sun.star.table.cellrangeaddress **
** oThisWSRow as object**
** oThisWSRowRngAddr as com.sun.star.table.cellrangeaddress**
** oThisWSCol as object**
** oThisWSCell as object**
** oRngAddress as object**
** end Type**
then
execute a class sub with…
public sub initialise_wsSummary()
**dim tvWSObj as gtyStdWSObjs**
** dim cWsName as string **
** set tvWSObj = nothing**
** cWsName = clscmmn.cBAWsName**
** clscmmn.sSetWSArea( cWsName, tvWSObj )**
and finally the populate sub…
private sub sSetWSArea ( scWSName as string, svWSObjs as gtyStdWSObjs )
svWSObjs.oThisWS = goThisDoc.Sheets.getbyname( scWSName )
gvEoBdyRow = clsCmmn.getLastRow( svWSObjs.oThisWS )
ends with a ‘BASIC runtime error. Object variable not set’ on the first line of the above ‘sub’
not looking to a ‘fix’ rather just an answer that a user-defined TYPE variable / object can be passed into sub/functions. and if ‘yes’, defining one at the GLOBAL section, should be ok too?