I just realised that I sent the last message privately, sorry for that. Here's the same thing (with some additions) but to the list instead:
2011/8/18 Thomas Krumbein <thomaskrumb...@openoffice.org>: > Hey Johnny, > > honestly, a lot of your questions/things are "basics"... Yes, I know. So that's why nobody replies, I suppose. Maybe I'd be better off sending them to the users' list instead, then. I'll do that next time. Thanks for the warning. We guitar players are not too bright… > VALUE, STRING, FORMULA and DATETIME are reserved words in Basic and > cannot be used as constant or variable names. Ever thought about this? Well, I know STRING is (it turns blue when I type it). But why did it work in my other example? And why did the monitor show the right values? But I'm sure going to try your suggestion, the one about not using those names. Thanks! I was originally going to use the original values, like ”com.sun.star.sheet.CellFlags.STRING”, but all those long (or broken) lines are so hard to read, so I like to keep it short, but not too short… Yes, I am a beginner (I will probably always be) and yes, I have troubles understanding English some times, which makes it even harder for me, since almost all information I can find is in English. Best regards Johnny Rosenberg ジョニー・ローゼンバーグ > > Try to put a character in Front (i.E. nValue, or myString) and > everything works as expected.... > > Best regards > Thomas > > > Am 18.08.2011 12:52, schrieb Johnny Rosenberg: > 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 >> ジョニー・ローゼンバーグ -- ----------------------------------------------------------------- To unsubscribe send email to dev-unsubscr...@api.openoffice.org For additional commands send email to sy...@api.openoffice.org with Subject: help