What should I do? BASIC runtime error. Property or method not found:CellAddress

(sorry I’m new to this) so i pressed a row than that recall button Caprturethen it said: BASIC runtime error. Property or method not found:CellAddress and it highlighted this: r=ThisComponent.CurrentSelection.CellAddress.Row (if i press recall its supposed to open up that row as an invoice) I didn’t create this


sub RecallfromRegi
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

S=ThisComponent.CurrentController.ActiveSheet.Name
r=ThisComponent.CurrentSelection.CellAddress.Row

SSheet=ThisComponent.Sheets.getbyname("Set")
SSheet.	getcellbyposition(1,49).string = S
SSheet.	getcellbyposition(1,48).string = ""

If S = "InvRe" Then
SSheet.getcellbyposition(1,50).value =_
ThisComponent.Sheets.getbyname("InvRe").getcellbyposition(0,r).value
InvNo		=SSheet.	getcellbyposition(1,50).string
RecallMatch	=SSheet.	getcellbyposition(1,52).value + 1
LastRow		=SSheet.	getcellbyposition(1,53).value - 1

If InvNo = "" OR r < 205 OR r >= LastRow then
 MsgBox ("You need to be on the row of the Invoice you want to recall.",64,"ERROR")
 ThisComponent.CurrentController.Frame.getContainerWindow.setFocus(True)
 Exit sub
End if

DeleteInvoice
ThisComponent.Sheets.getbyname("Inv").getcellbyposition(4,116).value=ThisComponent.Sheets.getbyname("Set").getcellbyposition(1,50).value

ElseIf S = "QuoRe" Then
SSheet.getcellbyposition(1,54).value =_
ThisComponent.Sheets.getbyname("QuoRe").getcellbyposition(0,r).value
InvNo		=SSheet.	getcellbyposition(1,54).string
RecallMatch	=SSheet.	getcellbyposition(1,56).value + 1
LastRow		=SSheet.	getcellbyposition(1,57).value - 1

If InvNo = "" OR r < 205 OR r >= LastRow then
 MsgBox ("You need to be on the row of the Quote you want to recall.",64,"ERROR")
 ThisComponent.CurrentController.Frame.getContainerWindow.setFocus(True)
 Exit sub
End if 

CancelQuote
ThisComponent.Sheets.getbyname("Quo").getcellbyposition(4,116).value=ThisComponent.Sheets.getbyname("Set").getcellbyposition(1,54).value

End If

RecallInv

end sub

What is selected when the error message is appeared: a single cell, or a cell range, or some other object?
.
Install and use an Object inspection tool (MRI, XrayTool) to list the existing properties and methods of the selected object.

Please improve your question. Because in this form, the immediate correct (and useless) answer would be “Press OK”.

  1. Provide the macro text as text, in addition to the screenshot. You can’t expect people who decided to help you to waste time re-typing what you typed, and double-waste time checking if there were no typos.
  2. Provide specific steps to reproduce the error. E.g., what @Zizi64 asked.
  3. Describe what your code is intended to do, and which cases it is intended to handle.
  4. By the way, describe if you are creating the code, or are you using some extension and seeing it fail?

… etc.

Let’s explain, what you see. The interpreter for macros complains not to be able to complete the task, because the necessary information is missing. It tries to get the address of the current selection in your sheet, but at the usual place there is no CellAddress available.
.
So your(?) Macro is in a similiar situation as somebody in a post office who shall deliver a parcel, wich has no address on it.
.
Therefore Zizi asked, what is/was selected, when the macro started. What to do then depends on the following (invisible) lines if code, so we can not know, what is the intended use of the address, besides “I wan’t to know, in wich row the selection is”. Thats why you are asked to provide the complete file or as minimal requirement the complete macro. Please note, a macro is not necessarily in your document, it could also be in an extension or your user-profile.
.
Edit:
A bit of guesswork: read above your error in the other sub: “You need to be in the row…” and select a cell in the row with data you wish to “recall”
.
As a PS I recommend to change your tag, as “base” is the database connector in LibreOffice. You seem to be in Calc and maybe “Calc macro BASIC” is a decent hint to attract people with tge right knowledge…

The selection is a cell range which has no CellAddress.

The code simply doesn’t make sense.
It was obviously created based on a recorded macro, but as posted there isn’t a single call to an uno command. The only command we may expect actual action of is RecallInv in (about) line 54.
Assuming this should call another user defined routine like by RecallInv(), we can only state that the routine is missing. If not the DispatchHelper is assigned to a global variable, the “recorded lines” would again make no sense.
MS would tell “Contact the vendor of the software”, and leave it at that.

1 Like

Yes! … and The Pope is a Catholic

So… your …CurrentSelection is actually a whole row, but not a single Cell with Attribute CellAddress

'change the line above to:

r=ThisComponent.CurrentSelection.RangeAddress.StartRow

…And it is possible to examine by your code if the selection is a single Cell or a CellRange (or some other object)…