[Solved] Macro not available in Form for switchboard
[Solved] Macro not available in Form for switchboard
Hello AOO
Following step by step instruction in the tutorial for standalone forms/switchboard.
One of my forms has 2 sub forms. The main form has a macro that clears content when the form is opened. When I tested the standalone form I got a message the Basic script could not be loaded.
I checked Events, When Loading...gives the appearance the script is there, but it is not. How do I get the script onto the standalone form, copying does not seem to be an option.
Thanks in advance
Stephanie
Following step by step instruction in the tutorial for standalone forms/switchboard.
One of my forms has 2 sub forms. The main form has a macro that clears content when the form is opened. When I tested the standalone form I got a message the Basic script could not be loaded.
I checked Events, When Loading...gives the appearance the script is there, but it is not. How do I get the script onto the standalone form, copying does not seem to be an option.
Thanks in advance
Stephanie
Last edited by iqullc on Sat Mar 08, 2014 3:17 pm, edited 1 time in total.
Windows7 AOO 4.0.0
Re: Macro not available in standalone Form for switchboard
The macro needs to be saved either in a general openoffice module (called "my macros" or "openoffice macros" in the window from Tools->Macros->Organize Macros->select language used) - and I think in the general modules macros have to be "activated" before they can be used by a specific document - or saved inside the module for the standalone form (this is most common, and I think easiest). I suspect the macro you need is saved in the *.odb form and hasn't been copied to the module for the standalone form. It doesn't do the form any good to have the name of the macro (what is shown in Events tab) if the text of the macro isn't available to it.
OpenOffice 4.1.1 on Windows 10, HSQLDB 1.8 split database
Re: Macro not available in standalone Form for switchboard
Thanks MTP as always I will give this a try and follow up.
It sounds like the macro will reside in two places...in the Standard folder under my database folder and as you suggest under general modules, will this cause a conflict at run time for the form?
BTW I see you have 4.0.1...I installed it and having considerable delays and lag times with everything. Have you experienced the same?
It sounds like the macro will reside in two places...in the Standard folder under my database folder and as you suggest under general modules, will this cause a conflict at run time for the form?
BTW I see you have 4.0.1...I installed it and having considerable delays and lag times with everything. Have you experienced the same?
Windows7 AOO 4.0.0
Re: Macro not available in standalone Form for switchboard
I'm not very familiar with how macros behave when saved in one of the generic locations; all the ones I use I've saved inside the document that needs them (including standalone forms). I think there's a hierarchy of some sort and the program will choose the one lower in the hierarchy if there are multiple macros named the same.
I haven't had any problems with 4.0.1 and am not sure what would be causing your performance issues.
I haven't had any problems with 4.0.1 and am not sure what would be causing your performance issues.
OpenOffice 4.1.1 on Windows 10, HSQLDB 1.8 split database
Re: Macro not available in standalone Form for switchboard
Often delays in OpenOffice are caused by links to off-site (internet) locations. If possible, remove these.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.5 LTS
Re: Macro not available in standalone Form for switchboard
Hello
When it happens when you change from the form in edit mode to working mode then it can be a problem of a bad designed from. This happens most of the time only when you have a lot of controls in your forms. Anchor all the controls to page.
Storing the macro's in different places is not a reasons for slowing down.
When you have bad designed macros then it can be a reason of slowing down. A bad designed macro is: a great number of loops and inside the loop SQL commands.
Romke
You are not clear about when the delay happens?iqullc wrote:BTW I see you have 4.0.1...I installed it and having considerable delays and lag times with everything. Have you experienced the same?
When it happens when you change from the form in edit mode to working mode then it can be a problem of a bad designed from. This happens most of the time only when you have a lot of controls in your forms. Anchor all the controls to page.
Storing the macro's in different places is not a reasons for slowing down.
When you have bad designed macros then it can be a reason of slowing down. A bad designed macro is: a great number of loops and inside the loop SQL commands.
Romke
LibreOffice 24.8.5.2 on openSUSE Leap 15.6
Re: Macro not available in standalone Form for switchboard
thanks to all the replies.
@RPG I posted the lag time issue earlier today...since installing 4.0.1 opening a form, editing, dragging/sizing controls any and everything has significant lag time, even typing and selecting. I built the database and forms using 4.0 none of these problems occurred.
@RoryOF, I do not understand about links to off-site (internet) locations, could you explain?
@RPG I posted the lag time issue earlier today...since installing 4.0.1 opening a form, editing, dragging/sizing controls any and everything has significant lag time, even typing and selecting. I built the database and forms using 4.0 none of these problems occurred.
@RoryOF, I do not understand about links to off-site (internet) locations, could you explain?
Windows7 AOO 4.0.0
Re: Macro not available in standalone Form for switchboard
If an OpenOffice file contains links to an Internet site - as for example to download a picture, but there are other purposes - It is said that it checks the valdity of each link on opening. Should a link not be available, or be slow, it pauses, waiting for that link to verify.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.5 LTS
Re: Macro not available in standalone Form for switchboard
Hello
When it works good in OOo 4.0.0 and not in OOo 4.0.1 then I have no idea. You can try to renew the user profile and try if this helps.
Maybe this [Tutorial] The OOo user profile can help you. With unkown problems I try real often a new user profile. I rename only the directory. First close OOo complete also the quickstarter.
Romke
When it works good in OOo 4.0.0 and not in OOo 4.0.1 then I have no idea. You can try to renew the user profile and try if this helps.
Maybe this [Tutorial] The OOo user profile can help you. With unkown problems I try real often a new user profile. I rename only the directory. First close OOo complete also the quickstarter.
Romke
LibreOffice 24.8.5.2 on openSUSE Leap 15.6
Re: Macro not available in standalone Form for switchboard
Some additional information:MTP wrote:The macro needs to be saved either in a general openoffice module (called "my macros" or "openoffice macros") - or - saved inside the module for the standalone form (this is most common, and I think easiest).
You can save macros within the document including Base .odb, Calc .ods, and Writer .odt - or - in the global 'My Macros' location. The 'OpenOffice/LibreOffice Macros' location is read-only. Each location has its own advantages and disadvantages. 'My Macros' is great for universal libraries and extensions due to the application-wide scope. But macros stored within individual documents are more portable since they work across *Office installations and computers. Since portability is often a consideration, the preferred location for macros used by standalone forms is the document itself (.odt). And keep in mind that portability is a factor even when when using a cloud folder for non-concurrent access (Dropbox, Google Drive, etc.), just as it is with USB sneakernet.
Either way, you'll need to modify any reference to 'ThisDatabaseDocument' since that context is lost when exporting macros from a Base .odb file. In most cases 'ThisComponent' will serve as an apt replacement.
- For instance, if you want to open another standalone form (.odt) from a push button, the code for a Form embedded within the Base .odb file is no longer applicable:
Open Form macro stored within Base document (.odb):Open Form macro stored within standalone Writer Form (.odt) using Shell:Code: Select all
Sub OpenAddressForm 'Button > Event > Execute action ThisDatabaseDocument.FormDocuments.GetByIndex(0).open() '.GetByName("<form name here>") may be easier to troubleshoot Wait 100 'required on slower CPUs ThisDatabaseDocument.FormDocuments.GetByIndex(0).Component.Drawpage.Forms.GetByIndex(0).moveToInsertRow End Sub
Code: Select all
Sub OpenAddressForm 'Button > Event > Execute action sPath = Left(ThisComponent.Location, Len(ThisComponent.Location) - Len(ThisComponent.Title)) sForm = ConvertToURL(sPath & "New Address.odt") 'example includes spaces sWriter = ConvertToURL(CurDir & "\") & "swriter.exe" 'Windows exe Shell (sWriter,,sForm) End Sub

...
AOO 4.1.x; LO 4.2.x; Windows 7/8 64-bit
Warning: Avoid embedded databases --> Solution: Adopt a portable 'split database' folder
Soli Deo gloria
Warning: Avoid embedded databases --> Solution: Adopt a portable 'split database' folder
Soli Deo gloria
Re: Macro not available in standalone Form for switchboard
Thanks to all, contemplating... 

Windows7 AOO 4.0.0
Re: Macro not available in standalone Form for switchboard
I opted to load the macro in the standard folder of the form that calls it. thanks!!! it works. 

Windows7 AOO 4.0.0
Re: [Solved] Macro not available in Form for switchboard
Hello,
Working with standalone files "first_file.odt" and "second_file.odt".
I was able to open the main form in "second_file.odt" from the main form of "first_file.odt".
Now, "ThisComponent.Drawpage.Forms(0) refers to the main form of the "first_file.odt" even when main form of "second_file.odt" is displayed.
How do we refer to the main form of "second_file.odt" programatically?
(i.e. it has field itemid and would like to assign it some some value.)
Tried
sPath = Left(ThisComponent.Location, Len(ThisComponent.Location) - Len(ThisComponent.Title))
myForm = ConvertToURL(sPath & "second_file.odt")
ThisComponent.Drawpage.Forms(myForm) still refers to the first_file.odt
Thanks
Working with standalone files "first_file.odt" and "second_file.odt".
I was able to open the main form in "second_file.odt" from the main form of "first_file.odt".
Now, "ThisComponent.Drawpage.Forms(0) refers to the main form of the "first_file.odt" even when main form of "second_file.odt" is displayed.
How do we refer to the main form of "second_file.odt" programatically?
(i.e. it has field itemid and would like to assign it some some value.)
Tried
sPath = Left(ThisComponent.Location, Len(ThisComponent.Location) - Len(ThisComponent.Title))
myForm = ConvertToURL(sPath & "second_file.odt")
ThisComponent.Drawpage.Forms(myForm) still refers to the first_file.odt
Thanks
OpenOffice 3.1 on Ubuntu 12.4