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


Here's another delicate problem that's easy to work around, but still
very strange:

Module 2:
———Code starts below———
REM  *****  BASIC  *****

Option Explicit

Public Const VALUE=1
Public Const STRING=4
Public Const FORMULA=16
Public Const DATETIME=2

Sub HelloWorld
        Print "Hello world!"
End Sub
———End of code———


Module1:
———Code starts below———
REM  *****  BASIC  *****

Option Explicit

Sub Main
        Dim A
        A=VALUE+STRING+FORMULA
End Sub
———End of code———
Run Main and you will get an error message at ”A=VALUE+STRING+FORMULA”.
If you run step by step (Ctrl+F8 in the BASIC IDE) and stop at that
line and then hover your mouse pointer over VALUE or STRING or
FORMULA, you can clearly see its values, but obviously this doesn't
help. Dimensioning A as Variant, as I did, doesn't help either. If you
look at VALUE, STRING or FORMULA in the variable monitor (or whatever
it's called in English), the window at the bottom left, you can see
that they are Variant/Integer and you can see their correct values.

So now, let's move the constant definition to Module1:
Module 2:
———Code starts below———
REM  *****  BASIC  *****

Option Explicit

Sub HelloWorld
        Print "Hello world!"
End Sub
———End of code———


Module1:
———Code starts below———
REM  *****  BASIC  *****

Option Explicit

Public Const VALUE=1
Public Const STRING=4
Public Const FORMULA=16
Public Const DATETIME=2

Sub Main
        Dim A
        A=VALUE+STRING+FORMULA
End Sub
———End of code———

Now Main in Module1 works as expected, but take a look in the monitor
again. Those constants appears in exactly the same way this time as
before, the only exception is that this works.
I would be very grateful for an explanation about this. Is there
REALLY a logical reason for it to be this way or should I report this
as a bug as soon as possible?

Of course I can define those constants in every module, but isn't one
of the points by declaring as Public that I can reach them in all my
modules? Well, in this case I can; I just can't use them, at least not
when adding them to each other.
”A=VALUE” works in both my examples, but obviously not
”A=VALUE+STRING+FORMULA” for some reason I am sure absolutely nobody
can explain, so please prove me wrong here…!

:D


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.