Hey there friends.
I am looking for a way to determine with basic if some of the form documents i have is just opened.
Because the property filter, for example, doesnt exist until it is totally opened.
howto ?
thx in advance
Is it a form document opened ?
Is it a form document opened ?
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
-
- Volunteer
- Posts: 1549
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: Is it a form document opened ?
Maybe this will help you. It should display the names of all the open forms when invoked by the Approve Action event of a button control on a form.
Code: Select all
REM ***** BASIC *****
Sub ShowOpenForms
Dim oDoc
Dim oComp
Dim oFormsDocs
Dim i as integer
Dim sFrmTitl as string, sOpenForms as string
'If Not Globalscope.BasicLibraries.isLibraryLoaded("MRILib") Then
' Globalscope.BasicLibraries.LoadLibrary( "MRILib" )
'End If
'oMRI = CreateUnoService( "mytools.Mri" )
oDoc = ThisComponent
'oMRI.inspect oDoc
oFormsDocs = oDoc.Parent.FormDocuments
'oMRI.inspect oFormsDocs
sOpenForms = "Open Forms:" & CHR$(10)
For i = 0 to oFormsDocs.Count - 1
oComp = oFormsDocs.getByIndex(i).Component
'oMRI.inspect oComp
if NOT IsNull(oComp) then
sFrmTitl = MID(oComp.Title, InStr(oComp.Title, ":") +1)
sOpenForms = sOpenForms & sFrmTitl & CHR$(10)
end if
next i
MsgBox sOpenForms
End Sub ' ShowOpenForms
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Re: Is it a form document opened ?
seems interesting, thx so much !
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
-
- Volunteer
- Posts: 1549
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: Is it a form document opened ?
The code shown above will fail if you try to Run the macro from the Run button on the IDE or from Tools->Macros->Organize Macros->Open Office Basic ->Run
To fix that problem replace the line
with
To fix that problem replace the line
Code: Select all
oFormsDocs = oDoc.Parent.FormDocuments
Code: Select all
oFormsDocs = oDoc
Do while oFormsDocs.ImplementationName <> "com.sun.star.comp.dba.ODatabaseDocument"
oFormsDocs = oFormsDocs.Parent
Loop
oFormsDocs = oFormsDocs.FormDocuments
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11