[Gelöst] Makro Calc Dialog Listbox füllen

Programmierung unter AOO/LO (StarBasic, Python, Java, ...)

Moderator: Moderatoren

retuwe61
****
Beiträge: 159
Registriert: So, 18.11.2007 21:25

[Gelöst] Makro Calc Dialog Listbox füllen

Beitrag von retuwe61 »

Hallo Miteinander.
Ich möchte eine Listbox auffüllen mit dem Text aus jeder zweiten Zelle in Zeile 1.
Kann bitte jemand einen Blick darauf werfen, wo der Fehler in der Zeile "oDialog.Model.getByName..." steckt?
Vielen Dank.
Gruß
Uwe

Code: Alles auswählen

Sub Dlg_Hersteller
Dim oBib as Object, oDgl as Object
DialogLibraries.LoadLibrary("Standard")
oBib = DialogLibraries.getByName("Standard")
oDgl = oBib.getByName("Dialog1")
oDialog = CreateUnoDialog(oDgl)

Dim oListBox as Object, aListe(), oForm as Object
oDoc = thisComponent
oSheet = oDoc.Sheets.getByName ("Work")

aSp = array("0", "2", "4", "6", "8", "10", "12", "14", "16", "18", "20", "22")

for i = 0 to 12
oCell = oSheet.getCellByPosition(aSp(i),0)
aListe = oCell.String
'msgbox aListe
if oSheet.getCellbyPosition(aSp(i),0).string = "" then
	exit for
	end if
next i
oDialog.Model.getByName("ListBox1").StringItemList = aListe()
oDialog.execute()
end sub
Zuletzt geändert von retuwe61 am Sa, 14.04.2018 09:06, insgesamt 1-mal geändert.
Angewandt wird LibeOffice Version 5.1.6.2
Stephan
********
Beiträge: 12369
Registriert: Mi, 30.06.2004 19:36
Wohnort: nahe Berlin

Re: Makro Calc Dialog Listbox füllen

Beitrag von Stephan »

wo der Fehler in der Zeile "oDialog.Model.getByName..." steckt?
In dieser Zeile ist kein Fehler. Hingegen enthält die Variable aListe kein Array, was aber notwendig ist.

z.B.:

Code: Alles auswählen

Sub Dlg_Hersteller
Dim oBib as Object, oDgl as Object
DialogLibraries.LoadLibrary("Standard")
oBib = DialogLibraries.getByName("Standard")
oDgl = oBib.getByName("Dialog1")
oDialog = CreateUnoDialog(oDgl)

Dim oListBox as Object, aListe(12), oForm as Object
oDoc = thisComponent
oSheet = oDoc.Sheets.getByName ("Work")

aSp = array("0", "2", "4", "6", "8", "10", "12", "14", "16", "18", "20", "22")

for i = 0 to 12
oCell = oSheet.getCellByPosition(aSp(i),0)
aListe(i) = oCell.String
'msgbox aListe
if oSheet.getCellbyPosition(aSp(i),0).string = "" then
	exit for
	end if
next i
oDialog.Model.getByName("ListBox1").StringItemList = aListe()
oDialog.execute()
end sub
Gruß
Stephan
retuwe61
****
Beiträge: 159
Registriert: So, 18.11.2007 21:25

Re: Makro Calc Dialog Listbox füllen

Beitrag von retuwe61 »

Danke dir Stephan.
Du hast natürlich Recht.
Gruß
Uwe
Angewandt wird LibeOffice Version 5.1.6.2
Antworten