OpenOffice BASIC IsNumber

902 views Asked by At

I have to migrate document from MS Excel to Open Office with macros. Everything works fine except this function

 If Application.WorksheetFunction.IsNumber(Cells(12, 5)) = False Then
   MsgBox "Nesprávne zadané číslo účtu alebo kód banky!", vbCritical
   ActiveSheet.Protect Password:="****", DrawingObjects:=True, Contents:=True, Scenarios:=True
   Exit Sub
 End If

It's check for values inserted by user. But I get only this error:

BASIC runtime error Variable of object is not set

So I double checked my document, if cell E12 is not empty, but it was filled. Is there in Open Office a different way to check input format? Thanks

2

There are 2 answers

0
Csabi On BEST ANSWER

The number in Excel Visual basic is different like in oo. try use getCellByName("E12").Value this function returns you Number

0
Hans Olsson On

If the line If Application.WorksheetFunction.IsNumber(Cells(12, 5)) = False Then fails saying object not set, and you've verified that Cells(12, 5) returns a a value, then the only possibilities that I can think of would be that either Application or Application.WorksheetFunction is Nothing.