1

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

BenMorel
  • 34,448
  • 50
  • 182
  • 322
tomasBULL
  • 563
  • 5
  • 10

2 Answers2

1

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

Csabi
  • 3,097
  • 17
  • 59
  • 107
0

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.

Hans Olsson
  • 54,199
  • 15
  • 94
  • 116