Re: Global variables – OpenOffice .org Basic
Johnny Rosenberg <[email protected]> Sun, 14 Aug 2011 07:45:35 +0200
| Newsgroups | gmane.comp.openoffice.devel.api |
|---|---|
| Message-ID | <CADo7T4eEpJzFLgj1F1E3m4pjUwGW0fUve9swLgJk0L-BX7PU+A@mail.gmail.com> |
011/8/14 Andrew Douglas Pitonyak <[email protected]>: > Let me start by saying that this works just fine using OOo for all cases > without resorting to Global. > > Do you have Option Compatible set anywhere? > No, isn't that for compatibility with Visual Basic? I'm not sure why I would like to be compatible with that=E2=80=A6 Anyway, it worked (as far as I remember) without Global, but NOT from the IDE by pressing F5 in some cases. Kind regards Johnny Rosenberg =E3=82=B8=E3=83=A7=E3=83=8B=E3=83=BC=E3=83=BB=E3=83=AD=E3=83=BC=E3=82=BC=E3= =83=B3=E3=83=90=E3=83=BC=E3=82=B0 > > > On 08/08/2011 11:42 AM, Johnny Rosenberg wrote: >> >> I am testing some functions at the moment (I wrote them a few years >> ago and now I'm trying to make them faster=E2=80=A6) but I am a bit stuc= k at >> the moment. >> >> It looks something like this: >> >> Module1 >> =C2=AF=C2=AF=C2=AF=C2=AF=C2=AF=C2=AF=C2=AF >> ' Code starts here >> Option Explicit >> >> Type Blahblah >> =C2=A0 =C2=A0 =C2=A0 =C2=A0This As Integer >> =C2=A0 =C2=A0 =C2=A0 =C2=A0That As Integer >> End Type >> >> Dim OneThing As Blahblah >> Dim MoreStuff As Integer >> >> Sub Main >> =C2=A0 =C2=A0 =C2=A0 =C2=A0Dim X As Integer >> =C2=A0 =C2=A0 =C2=A0 =C2=A0Some stuff >> =C2=A0 =C2=A0 =C2=A0 =C2=A0X=3DMyFunction(47) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0More stuff >> End Sub >> ' End of code >> >> Module2 >> =C2=AF=C2=AF=C2=AF=C2=AF=C2=AF=C2=AF=C2=AF >> ' Code starts here >> Function MyFunction(A As Integer) As Integer >> =C2=A0 =C2=A0 =C2=A0 =C2=A0Dim SomeValue As Integer >> =C2=A0 =C2=A0 =C2=A0 =C2=A0Some stuff >> =C2=A0 =C2=A0 =C2=A0 =C2=A0OneThing.This=3DA*SomeValue >> =C2=A0 =C2=A0 =C2=A0 =C2=A0More stuff >> =C2=A0 =C2=A0 =C2=A0 =C2=A0MyFunction=3DOneThing.This-A >> End Function >> ' End of code >> >> Now, when running this (with F5 or F8), it seems like it starts at >> =E2=80=9DSub Main=E2=80=9D and everything above it is omitted, so I get = an error >> message in module2 when =E2=80=9DOneThing=E2=80=9D is mentioned. >> Shouldn't the global things be available in all modules? They are if I >> run similar macros from a spreadsheet, for example, that is not from >> the Basic IDE. >> >> Did I miss something here? Is there a way around it? >> >> >> Kind regards >> >> Johnny Rosenberg >> =E3=82=B8=E3=83=A7=E3=83=8B=E3=83=BC=E3=83=BB=E3=83=AD=E3=83=BC=E3=82=BC= =E3=83=B3=E3=83=90=E3=83=BC=E3=82=B0 > > -- > Andrew Pitonyak > My Macro Document: http://www.pitonyak.org/AndrewMacro.odt > Info: =C2=A0http://www.pitonyak.org/oo.php > > -- > ----------------------------------------------------------------- > To unsubscribe send email to [email protected] > For additional commands send email to [email protected] > with Subject: help > --=20 ----------------------------------------------------------------- To unsubscribe send email to [email protected] For additional commands send email to [email protected] with Subject: help