Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Once again I did it: I sent my reply directly to the OP, not to the
list. Sorry. *Sigh…*

Here's what I wrote, in case someone is interested:

<Message>
2012/10/20 Johnny Rosenberg <gurus.knugum@gmail.com>:
2012/10/20 Luuk <luuk34@gmail.com>:
When i go to
Tools/Macros/Organize Macros/LibreOffice Basic

Than i see i macro called 'CallUsLeapYear' under:
Libreoffice Macros/Tools/Misc

How can this macro be used a cell?

Can't find it. I only find ”CalIsLeapYear”.

It returns "True" if the number inside the parenthesis is a leapyear,
otherwise "False".

First you need to move or copy it to, I think it's called ”MyMacros & Dialogs”.

Now, for example:
=IF(CALISLEAPYEAR(A15)="True";A15 & " is very much a leapyear!”;A15 &
"is certainly not a leapyear, idiot!")

The tricky part here is that CALISLEAPYEAR doesn't return the Boolean
values TRUE or FALSE, it returns ”True” or "False" as text! This is
particularly odd since the macro code looks like this:
Function CalIsLeapYear(ByVal iYear as Integer) as Boolean
        CalIsLeapYear = ((iYear Mod 4 = 0) And ((iYear Mod 100 <> 0)
Or (iYear Mod 400 = 0)))
End Function

So it looks like it returns a Boolean value, but obviously Calc is
converting it to text somehow. I can't really see the point by doing
this, it just looks stupid to me.

And you don't need this macro very much anyway, since there is a Calc
function called ISLEAPYEAR(), ready to be used:
=IF(ISLEAPYEAR("1984-01-01");"Yes";"No")

Note that you must use the date format of your locale settings.


Kind regards

Johnny Rosenberg
ジョニー・ローゼンバーグ
</Message>

Now, let's move on to the last message in the thread:
<Message>
On 20-10-2012 14:11, Johnny Rosenberg wrote:
 2012/10/20 Luuk <luuk34@gmail.com>:
 When i go to
 Tools/Macros/Organize Macros/LibreOffice Basic

 Than i see i macro called 'CallUsLeapYear' under:
 Libreoffice Macros/Tools/Misc

 How can this macro be used a cell?

 Can't find it. I only find ”CalIsLeapYear”.


 oops, typo... ;)


 It returns "True" if the number inside the parenthesis is a leapyear,
 otherwise "False".

 First you need to move or copy it to, I think it's called ”MyMacros & Dialogs”.


 What is the use of the macros in the place i mentioned,
 if they cannot be used directly?
</Message>

I would guess that they are supposed to be called from other Basic subroutines.



Kind regards

Johnny Rosenberg
ジョニー・ローゼンバーグ

-- 
For unsubscribe instructions e-mail to: users+help@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.