Hallo, ich nutze auf einem PC Libre Offic und auf einem anderen OpenOffice. Für beide Calc habe ich Star Basic Programme in Anwendung. In LibreOffic laufen die StarBasic Scrips nicht. Es kommt die Fehlermeldung "Syntax Fehler erwarte Sub" sowohl Sub als auch End Sub sind aber vorhanden. Zur Zeit bin ich ratlos was da helfen könnte. ich hoffe auf Eure Meinungen oder Beträge Gruß Friedrich
Rätselhaftes StarBasic
Anmeldungsdatum: Beiträge: 29 |
|
Ehemalige
![]() Anmeldungsdatum: Beiträge: 4681 Wohnort: Berlin |
Wo kommt die Fehlermeldung und die müsste doch eigentlich noch genauer auf die Stelle im Quelltext hinweisen wo der Fehler bemerkt wurde. Das irgendwo |
![]() Anmeldungsdatum: Beiträge: 777 Wohnort: Hamburg |
Frage gehört StarBasic zu Shell Programierug? Ich denke mit deinem Problem bist du im Libre/OpenOdffice Forum besser aufgehoben den nach meinem Empfinden hat es doch nichts mit Ubuntu zu tun? |
(Themenstarter)
Anmeldungsdatum: Beiträge: 29 |
Marc_BlackJack_Rintsch schrieb:
Die Fehlermeldung erfolgt genau in der letzten Zeile in der End Sub steht |
(Themenstarter)
Anmeldungsdatum: Beiträge: 29 |
Ja schon, aber beide Progs unterstützen doch StarBasic. Und kurios : Erst beim Script- Aufruf kommt der Fehler. |
Anmeldungsdatum: Beiträge: 182 |
|
![]() Anmeldungsdatum: Beiträge: 777 Wohnort: Hamburg |
Das ist richtig aber ubuntu und nicht StarBasic. Shell, Python, awk usw. Ist nach meinem Empfinden hier richtig, StarBasic ist in einem Programm und nicht im Betriebssysteme |
Anmeldungsdatum: Beiträge: 4414 |
Wobei LibreOffice schon zu Ubuntu gehört, im Thread, welche Themen hier her gehören, steht:
StarBasic von LibreOffice unter Linux, sogar Ubuntu.
Kannst du das auf ein kurzes Beispiel runterbrechen und hier posten? |
(Themenstarter)
Anmeldungsdatum: Beiträge: 29 |
Anbei der Teil an dem am Ende die Fehlermeldung kommt. Dieser Abschnitt ist als Aufzeichnung übernommen. Davor gibt es in noch mehrere Sub und End Sub, die scheinbar nicht betroffen sind. sub Purge rem definiere variable dim document as object dim Blatt as object dim Quad 1 (1 To 9, 1 To 9) As integer dim Quad 2 (1 To 9, 11 To 19) As integer dim Quad 3 ( 11 To 19, To 1 To 9) As integer rem Zugriff auf dieses Document Doc = ThisComponent rem Zugriff auf dieses Blatt Blatt = Dok.Sheets.getByName ("Tabelle2") rem Zugriff auf Quadratm Array 1 dim args1(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "ToPoint" args1(0).Value = "$B$2:$J$10" dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:ClearContents", "", 0, Array()) rem ---------------------------------------------------------------------- dim args2(0) as new com.sun.star.beans.PropertyValue args2(0).Name = "ToPoint" args2(0).Value = "$L$2:$T$10" dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:ClearContents", "", 0, Array()) rem ---------------------------------------------------------------------- dim args3(0) as new com.sun.star.beans.PropertyValue args3(0).Name = "ToPoint" args3(0).Value = "$B$12:$J$20" dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args3()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:ClearContents", "", 0, Array()) end sub Hier erscheint erst die Meldung Bearbeitet von rklm: Codeblock |
Ehemalige
![]() Anmeldungsdatum: Beiträge: 4681 Wohnort: Berlin |
@Friedrich-Gille: Quelltext bitte als Codeblock, sonst ist das im Beitrag nicht wirklich lesbar. Und dann auch den tatsächlichen Quelltext. Der hier bleibt erst bei |
![]() Anmeldungsdatum: Beiträge: 3101 |
Deswegen müsstest Du auch das komplette Skript posten. Da ein sub xyz weiter oben ohne end sub weiter unten durchaus auch den Fehler verursachen kann. |
Projektleitung
Anmeldungsdatum: Beiträge: 13192 |
Ja, das ist auch in der Shell ein typischer Fall: man vergisst irgendwo oben das schließende Anführungszeichen und bekommt dann eine Meldung, dass am Ende etwas nicht stimmt. Ganzes Skript wird auf jeden Fall hilfreich sein. |
(Themenstarter)
Anmeldungsdatum: Beiträge: 29 |
EM ***** BASIC ***** sub Sudoku1 Rem definire Variable rem definiere Datei, Tabelle und Zelle dim Dok as Object dim Blatt as Object dim Zelle as Object Dok = ThisComponent Blatt = Dok.Sheets.getByName ("Tabelle1") dim Sp as Integer rem Spalte des Hauptquadrat dim Re as Integer rem Reihe des Hauptquadrat dim oZelle as Object rem optionale Zelle im andern Quadrat dim oSp as Integer rem optionale Spalte dim oRe as Integer rem optionale Reihe dim pN7 as Integer rem soll die realen Werte in den anderen Quadraten setzem dim pN6 as Integer rem dito dim pN5 as Integer rem soll die realen Werte in den anderen Quadraten setzem dim pN4 as Integer rem dito dim pN3 as Integer rem Durchlauf bei "For pN2" setzt pN = 1 und sucht pN neu dim pN2 as Integer rem Durchlauf bei "For I" sucht pN "noch nicht belegt" dim pN as Integer rem zu prüfender Wert/Zahl sucht nP im Durchlauf bei "For pN" Sp = 1 rem Spalte B Re = 1 rem Zeile 2 oSp = 11 rem Spalte L oRe = 1 rem Zeile 2 Zelle = Blatt.getCellByPosition(Sp,Re) oZelle = Blatt.getCellByPosition(oSp,oRe) For pN3 = 1 To 9 For pN2 = 1 To 9 Zelle = Blatt.getCellByPosition(Sp,Re) oZelle = Blatt.getCellByPosition(oSp,oRe) let pN = 1 let oSp = 11 For pN = 1 To 9 Zelle = Blatt.getCellByPosition(Sp,Re) oZelle = Blatt.getCellByPosition(oSp,oRe) If oZelle.Value > 0 Then oZelle.Value = oZelle.Value ElseIf Zelle.Value = pN Then oZelle.Value = 99 Endif oSp = oSp + 1 Next pN let Sp = Sp +1 let oSp = oSp + 1 Next pN2 let Sp = 1 let oSp = 11 let Re = Re + 1 let oRe = oRe + 1 Next pN3 Sp = 1 rem Spalte B Re = 1 rem Zeile 2 oSp = 1 rem Spalte L oRe = 11 rem Zeile 2 For pN3 = 1To 9 For pN2 = 1 To 9 Zelle = Blatt.getCellByPosition(Sp,Re) oZelle = Blatt.getCellByPosition(oSp,oRe) let pN = 1 let oRe = 11 For pN = 1 To 9 Zelle = Blatt.getCellByPosition(Sp,Re) oZelle = Blatt.getCellByPosition(oSp,oRe) If oZelle.Value > 0 Then oZelle.Value = oZelle.Value ElseIf Zelle.Value = pN Then oZelle.Value = 99 Endif oRe = oRe + 1 Next pN let Re = Re +1 let oRe = oRe + 1 Next pN2 let Re = 1 let oRe = 11 let Sp = Sp + 1 let oSp = oSp + 1 Next pN3 rem die Reihen und Spalten Prüfung 31 bis hier OK, rem Aus Modul2 "Probe" kopiert rem die Prüfung Reihe plus Spalte noch programieren, wie? rem Zelle = Blatt.getCellByPosition(Sp,Re) 'oZelle = Blatt.getCellByPosition(oSp,oRe) ' 'For pN5 = 1 to 9 ' ' oZelle = Blatt.getCellByPosition (oSp,oRe) ' let pN = 1 ' let oRe = 1 ' let oSp = 11 ' For pN4 = 1 to 9 ' oZelle = Blatt.getCellByPosition (oSp,oRe) ' If oZelle.Value < 9 Then ' oZelle.Value = pN ' Endif ' oSp = oSp + 1 ' Next pN4 ' let oSp = 11 ' let oRe = oRe + 1 'Next pN5 ' 'oSp = 1 'oRe = 11 ' 'oZelle = Blatt.getCellByPosition(oSp,oRe) ' 'For pN7 = 1 to 9 ' ' oZelle = Blatt.getCellByPosition (oSp,oRe) ' let pN = 1 ' let oSp = 1 ' let oRe = 11 ' For pN6 = 1 to 9 ' oZelle = Blatt.getCellByPosition (oSp,oRe) ' If oZelle.Value < 9 Then ' oZelle.Value = pN ' Endif ' oRe = oRe + 1 ' Next pN6 ' rem let Sp = Sp +1 ' let oRe = 11 ' let oSp = oSp + 1 'Next pN7 end sub REM ***** BASIC ***** sub Sudoku2 Rem definire Variable rem definiere Datei, Tabelle und Zelle dim Dok as Object dim Blatt as Object dim Zelle as Object Dok = ThisComponent Blatt = Dok.Sheets.getByName ("Tabelle2") dim Sp as Integer rem Spalte des Hauptquadrat dim Re as Integer rem Reihe des Hauptquadrat dim oZelle as Object rem optionale Zelle im andern Quadrat dim oSp as Integer rem optionale Spalte dim oRe as Integer rem optionale Reihe dim pN7 as Integer rem soll die realen Werte in den anderen Quadraten setzem dim pN6 as Integer rem dito dim pN5 as Integer rem soll die realen Werte in den anderen Quadraten setzem dim pN4 as Integer rem dito dim pN3 as Integer rem Durchlauf bei "For pN2" setzt pN = 1 und sucht pN neu dim pN2 as Integer rem Durchlauf bei "For I" sucht pN "noch nicht belegt" dim pN as Integer rem zu prüfender Wert/Zahl sucht nP im Durchlauf bei "For pN" Sp = 1 rem Spalte B Re = 1 rem Zeile 2 oSp = 11 rem Spalte L oRe = 1 rem Zeile 2 Zelle = Blatt.getCellByPosition(Sp,Re) oZelle = Blatt.getCellByPosition(oSp,oRe) For pN3 = 1 To 9 For pN2 = 1 To 9 Zelle = Blatt.getCellByPosition(Sp,Re) oZelle = Blatt.getCellByPosition(oSp,oRe) let pN = 1 let oSp = 11 For pN = 1 To 9 Zelle = Blatt.getCellByPosition(Sp,Re) oZelle = Blatt.getCellByPosition(oSp,oRe) If oZelle.Value > 0 Then oZelle.Value = oZelle.Value ElseIf Zelle.Value = pN Then oZelle.Value = 99 Endif oSp = oSp + 1 Next pN let Sp = Sp +1 let oSp = oSp + 1 Next pN2 let Sp = 1 let oSp = 11 let Re = Re + 1 let oRe = oRe + 1 Next pN3 Sp = 1 rem Spalte B Re = 1 rem Zeile 2 oSp = 1 rem Spalte L oRe = 11 rem Zeile 2 For pN3 = 1To 9 For pN2 = 1 To 9 Zelle = Blatt.getCellByPosition(Sp,Re) oZelle = Blatt.getCellByPosition(oSp,oRe) let pN = 1 let oRe = 11 For pN = 1 To 9 Zelle = Blatt.getCellByPosition(Sp,Re) oZelle = Blatt.getCellByPosition(oSp,oRe) If oZelle.Value > 0 Then oZelle.Value = oZelle.Value ElseIf Zelle.Value = pN Then oZelle.Value = 99 Endif oRe = oRe + 1 Next pN let Re = Re +1 let oRe = oRe + 1 Next pN2 let Re = 1 let oRe = 11 let Sp = Sp + 1 let oSp = oSp + 1 Next pN3 rem die Reihen und Spalten Prüfung 31 bis hier OK, rem Aus Modul2 "Probe" kopiert rem die Prüfung Reihe plus Spalte noch programieren, wie? rem Zelle = Blatt.getCellByPosition(Sp,Re) 'oZelle = Blatt.getCellByPosition(oSp,oRe) ' 'For pN5 = 1 to 9 ' ' oZelle = Blatt.getCellByPosition (oSp,oRe) ' let pN = 1 ' let oRe = 1 ' let oSp = 11 ' For pN4 = 1 to 9 ' oZelle = Blatt.getCellByPosition (oSp,oRe) ' If oZelle.Value < 9 Then ' oZelle.Value = pN ' Endif ' oSp = oSp + 1 ' Next pN4 ' let oSp = 11 ' let oRe = oRe + 1 'Next pN5 ' 'oSp = 1 'oRe = 11 ' 'oZelle = Blatt.getCellByPosition(oSp,oRe) ' 'For pN7 = 1 to 9 ' ' oZelle = Blatt.getCellByPosition (oSp,oRe) ' let pN = 1 ' let oSp = 1 ' let oRe = 11 ' For pN6 = 1 to 9 ' oZelle = Blatt.getCellByPosition (oSp,oRe) ' If oZelle.Value < 9 Then ' oZelle.Value = pN ' Endif ' oRe = oRe + 1 ' Next pN6 ' rem let Sp = Sp +1 ' let oRe = 11 ' let oSp = oSp + 1 'Next pN7 end sub sub Moeglich rem definiere Datei, Tabelle und Zelle dim Dok as Object dim Blatt as Object dim Zelle as Object Dok = ThisComponent Blatt = Dok.Sheets.getByName ("Tabelle2") dim Sp as Integer rem aktuelle Spalte der Zelle dim Re as Integer rem aktuelle Reihe der Zelle dim prfZell as Object rem prüfe Zelle in dieser Reihe/Spalte dim prSp as Integer rem prüfe Spalte dim prRe as Integer rem prüfe Reihe prfZell = MsgBox (ActiveCell.Address) byPosition End Sub REM ***** BASIC ***** Sub Sudoku3 Rem definiere Variable rem definiere Datei, Tabelle und Zelle dim Dok as Object dim Blatt as Object dim Zelle as Object Dok = ThisComponent Blatt = Dok.Sheets.getByName ("Tabelle3") dim Sp as Integer rem Spalte des Hauptquadrat dim Re as Integer rem Reihe des Hauptquadrat dim oZelle as Object rem optionale Zelle im andern Quadrat dim oSp as Integer rem optionale Spalte dim oRe as Integer rem optionale Reihe dim pN7 as Integer rem soll die realen Werte in den anderen Quadraten setzem dim pN6 as Integer rem dito dim pN5 as Integer rem soll die realen Werte in den anderen Quadraten setzem dim pN4 as Integer rem dito dim pN3 as Integer rem Durchlauf bei "For pN2" setzt pN = 1 und sucht pN neu dim pN2 as Integer rem Durchlauf bei "For I" sucht pN "noch nicht belegt" dim pN as Integer rem zu prüfender Wert/Zahl sucht nP im Durchlauf bei "For pN" Sp = 1 rem Spalte B Re = 1 rem Zeile 2 oSp = 11 rem Spalte L oRe = 1 rem Zeile 2 Zelle = Blatt.getCellByPosition(Sp,Re) oZelle = Blatt.getCellByPosition(oSp,oRe) For pN3 = 1 To 9 For pN2 = 1 To 9 Zelle = Blatt.getCellByPosition(Sp,Re) oZelle = Blatt.getCellByPosition(oSp,oRe) let pN = 1 let oSp = 11 For pN = 1 To 9 Zelle = Blatt.getCellByPosition(Sp,Re) oZelle = Blatt.getCellByPosition(oSp,oRe) If oZelle.Value > 0 Then oZelle.Value = oZelle.Value ElseIf Zelle.Value = pN Then oZelle.Value = 99 Endif oSp = oSp + 1 Next pN let Sp = Sp +1 let oSp = oSp + 1 Next pN2 let Sp = 1 let oSp = 11 let Re = Re + 1 let oRe = oRe + 1 Next pN3 Sp = 1 rem Spalte B Re = 1 rem Zeile 2 oSp = 1 rem Spalte L oRe = 11 rem Zeile 2 For pN3 = 1To 9 For pN2 = 1 To 9 Zelle = Blatt.getCellByPosition(Sp,Re) oZelle = Blatt.getCellByPosition(oSp,oRe) let pN = 1 let oRe = 11 For pN = 1 To 9 Zelle = Blatt.getCellByPosition(Sp,Re) oZelle = Blatt.getCellByPosition(oSp,oRe) If oZelle.Value > 0 Then oZelle.Value = oZelle.Value ElseIf Zelle.Value = pN Then oZelle.Value = 99 Endif oRe = oRe + 1 Next pN let Re = Re +1 let oRe = oRe + 1 Next pN2 let Re = 1 let oRe = 11 let Sp = Sp + 1 let oSp = oSp + 1 Next pN3 end sub rem sub Purge rem rem definiere variable rem dim document as object rem dim Blatt as object rem dim Quad 1 (1 To 9, 1 To 9) As integer rem dim Quad 2 (1 To 9, 11 To 19) As integer rem dim Quad 3 ( 11 To 19, To 1 To 9) As integer rem rem Zugriff auf dieses Document rem Doc = ThisComponent rem Zugriff auf dieses Blatt rem Blatt = Dok.Sheets.getByName ("Tabelle2") rem Zugriff auf Quadratm Array 1 rem rem dim args1(0) as new com.sun.star.beans.PropertyValue rem args1(0).Name = "ToPoint" rem args1(0).Value = "$B$2:$J$10" rem rem dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1()) rem rem ---------------------------------------------------------------------- rem dispatcher.executeDispatch(document, ".uno:ClearContents", "", 0, Array()) rem rem ---------------------------------------------------------------------- rem dim args2(0) as new com.sun.star.beans.PropertyValue rem args2(0).Name = "ToPoint" rem args2(0).Value = "$L$2:$T$10" rem rem dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2()) rem rem ---------------------------------------------------------------------- rem dispatcher.executeDispatch(document, ".uno:ClearContents", "", 0, Array()) rem rem ---------------------------------------------------------------------- rem dim args3(0) as new com.sun.star.beans.PropertyValue rem args3(0).Name = "ToPoint" rem args3(0).Value = "$B$12:$J$20" rem rem dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args3()) rem rem ---------------------------------------------------------------------- rem dispatcher.executeDispatch(document, ".uno:ClearContents", "", 0, Array()) rem rem end sub[mark]Formatierter Text[/mark] |
Ehemalige
![]() Anmeldungsdatum: Beiträge: 4681 Wohnort: Berlin |
@Friedrich-Gille: Bitte einmal ganz am Anfang die erste Zeile korrigieren, denn diese erste Zeile reicht schon aus um diese Fehlermeldung zu bekommen. Edit: Ich würde übrigens dringend empfehlen auch den Inhalt von Unterroutinen einzurücken, denn spätestens wenn man mehr als eine Unterroutine im Modul hat, kann das unübersichtlich werden wo welche anfängt und aufhört. |