Inconcistent (?) macro behaviour in experimental mode

classic Classic list List threaded Threaded
2 messages Options
Johnny Rosenberg Johnny Rosenberg
Reply | Threaded
Open this post in threaded view
|

Inconcistent (?) macro behaviour in experimental mode

This function seems to work fine:
Public Function GetCell(oSheet As com.sun.star.sheet.XSpreadsheet, _
                        lRow As Long, _
                        lCol As Long) As com.sun.star.sheet.XCell
    GetCell=oSheet.getCellByPosition(lCol, lRow)
End Function

For instance, this works fine:
Dim oLastDateCell As Object
oLastDateCell=GetCell(oSheet, lLastRow, ColDate)

No errors what so ever.
But, on the other hand, this throws an error:
Dim oLastDateCell As com.sun.star.sheet.XCell
oLastDateCell=GetCell(oSheet, lLastRow, ColDate) ' oSheet and more are
correctly defined someplace else.

Error message:
”BASIC syntax error.
Data type com.sun.star.sheet.XCell is unknown”

So it works as a return type for my GetCell function, but when defining a
variable, it's suddenly unknown? Can someone explain this?

Why I use experimental mode? Because I want to learn how it works plus a
few more reasons that are just as irrelevant.


Kind regards

Johnny Rosenberg

--
To unsubscribe e-mail to: [hidden email]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy
Johnny Rosenberg Johnny Rosenberg
Reply | Threaded
Open this post in threaded view
|

Re: Inconcistent (?) macro behaviour in experimental mode

Den sön 16 sep. 2018 kl 22:50 skrev Johnny Rosenberg <[hidden email]
>:

> This function seems to work fine:
> Public Function GetCell(oSheet As com.sun.star.sheet.XSpreadsheet, _
>                         lRow As Long, _
>                         lCol As Long) As com.sun.star.sheet.XCell
>     GetCell=oSheet.getCellByPosition(lCol, lRow)
> End Function
>
> For instance, this works fine:
> Dim oLastDateCell As Object
> oLastDateCell=GetCell(oSheet, lLastRow, ColDate)
>
> No errors what so ever.
> But, on the other hand, this throws an error:
> Dim oLastDateCell As com.sun.star.sheet.XCell
> oLastDateCell=GetCell(oSheet, lLastRow, ColDate) ' oSheet and more are
> correctly defined someplace else.
>
> Error message:
> ”BASIC syntax error.
> Data type com.sun.star.sheet.XCell is unknown”
>
> So it works as a return type for my GetCell function, but when defining a
> variable, it's suddenly unknown? Can someone explain this?
>
> Why I use experimental mode? Because I want to learn how it works plus a
> few more reasons that are just as irrelevant.
>
>
> Kind regards
>
> Johnny Rosenberg
>
>
Ok, maybe my bad. I found that the correct type is com.sun.star.table.XCell
for some reason, but one part of my question still remains: Why does
com.sun.star.sheet.XCell work as a return type of a function?

Kind regards

Johnny Rosenberg

--
To unsubscribe e-mail to: [hidden email]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
Privacy Policy: https://www.documentfoundation.org/privacy