Hi! As usual I don't have a clue about anything when it comes to OpenOffice Basic "programming".
I get an error message that I don't understand. Well, actually I understand it, but I don't understand exactly why I get it. Here is approximately what I do: Sub SkrivUtstamp Dim Dag As Date, Veckodag As Integer Dim Instamp As Double, Utstamp As Double Dim OBDef As Variant, OB(5) As Double Dim r As Integer, k As Integer {A few lines not relevant to my problem} ' Sorry for that some variable names are in Swedish... Dag=Sheet.getCellByPosition(0,Rad).getValue() Veckodag=Weekday(Dag)-1 If Veckodag=0 Then Veckodag=7 ' The line below will make OBDef an array - OBDef(2,5). In this case OBDef(2,x) will be String and the rest will be Double. OBDef=DataSheet.getCellRangeByPosition(4,1,9,3).getDataArray() For k=0 To 5 OB(k)=OverTime(OBDef(2,k), Veckodag, Instamp, Utstamp, OBDef(0,k), OBDef(1,k)) 'This line doesn't work. Rem OB(k)=OverTime("OB11",3,0.25,1,0.5,0.8) ' This example-line would work if not "Rem" was there. Next k {Yet another couple of unimportant lines, when it comes to describing my problem} Sub ' There is nothing wrong with the function below, it works when I just feed it with simple variables... When I do like I did above, I get an error message at the very first line of this function below. It says something like (free translation from Swedish, sorry) "The object variable is not defined": Function OverTime(TypeOfOB As String, DayOfWeek As Integer, StartTime As Double, EndTime As Double, OTStart As Double, OTEnd As Double) As Double Dim Factor As Double Factor=1 If TypeOfOB="ÖT75" Or TypeOfOB="ÖT100" Then If DayOfWeek<6 Then Factor=0 EndIf Else If DayOfWeek>5 Then Factor=0 EndIf EndIf If StartTime<OTStart Then StartTime=OTStart If EndTime>OTEnd Then EndTime=OTEnd If StartTime>EndTime Then StartTime=EndTime OverTime=Factor*(EndTime-StartTime) End Function So what does all this mean? What should I do instead? Kind regards Johnny