and it is realy closing the selected form but i can't open that form until i restart OOo. is there a solution to close a form by macro and than in some other time to open it without restarting OOo.
Code: Select all
Sub Close_Form_Button
Dim oForm As Object
Rem... This component hack
oForm = thisComponent.Parent.FormDocuments
if oForm.HasByName("FormName") then
oForm = oForm.getByName("FormName")
if not IsNull(oForm.Component) then
oForm = oForm.Component.DrawPage.Forms.getByName("MainForm")
End if
Else
msgbox "Form Not Found"
End if
oForm.parent.parent.CurrentController.Frame.close( true ) Rem... this way so dosen't close wrong form because of timing.
'thisComponent.CurrentController.Frame.close( true ) Rem.. This line commented out. Could close wrong form if you clicked to another too quickly
End Sub