Re: How can I read my code in a module in the Basic IDE with Basic code?
Johnny Rosenberg <[email protected]> Sun, 14 Aug 2011 17:39:07 +0200
| Newsgroups | gmane.comp.openoffice.devel.api |
|---|---|
| Message-ID | <CADo7T4cAw0Qf78MtP1mO10aJvjvPuCBdP83JN_-6-3H3D7PRhQ@mail.gmail.com> |
2011/8/14 Oliver Brinzing <[email protected]>: > Hi Johnny, > >> If I only can read all the text in one module at once, that would do >> it just fine. If there is a simple one-liner that reads just one >> function or subroutine, that's a bonus, and if I can read a dialogue >> that's even better=E2=80=A6 > > Have you tried: > > Sub Test() > > =C2=A0 =C2=A0 =C2=A0 =C2=A0Dim oLibs as Object > =C2=A0 =C2=A0 =C2=A0 =C2=A0Dim oLib as Object > =C2=A0 =C2=A0 =C2=A0 =C2=A0Dim sLib as String > > =C2=A0 =C2=A0 =C2=A0 =C2=A0Dim mTmp() > =C2=A0 =C2=A0 =C2=A0 =C2=A0Dim i as Integer > =C2=A0 =C2=A0 =C2=A0 =C2=A0Dim s as String > > =C2=A0 =C2=A0 =C2=A0 =C2=A0sLib =3D "Standard" > =C2=A0 =C2=A0 =C2=A0 =C2=A0oLibs =3D GlobalScope.BasicLibraries > =C2=A0 =C2=A0 =C2=A0 =C2=A0If Not oLibs.hasByName(sLib) Then > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0MsgBox "Error read= ing " & sLib > =C2=A0 =C2=A0 =C2=A0 =C2=A0EndIf > > =C2=A0 =C2=A0 =C2=A0 =C2=A0oLib =3D oLibs.getByName(sLib) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0mTmp() =3D oLib.getElementNames() > > =C2=A0 =C2=A0 =C2=A0 =C2=A0For i =3D 0 To uBound(mTmp()) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0s =3D s + mTmp(i) = & Chr(13) > =C2=A0 =C2=A0 =C2=A0 =C2=A0Next i > =C2=A0 =C2=A0 =C2=A0 =C2=A0MsgBox s > > =C2=A0 =C2=A0 =C2=A0 =C2=A0MsgBox oLib.getByName(mTmp(0)) > > End Sub No, I didn't, but it seems to work for my global macros. I guess I need to change the =E2=80=9DoLibs =3D GlobalScope.BasicLibraries=E2=80=9D l= ine for local code (macros for the current document only), but to what? 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 > Regards > Oliver --=20 ----------------------------------------------------------------- To unsubscribe send email to [email protected] For additional commands send email to [email protected] with Subject: help