Most simple macro for all kinds of URLs, files, emails etc: https://forum.openoffice.org/en/forum/v ... 00&t=92331Easy installer in the test database. No customization required within the macro code. Just add your own push button to your own form with a column name as "additional info" and the "approve action" event pointing to the macro.

Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.Ubuntu 18.04, no OpenOffice, LibreOffice 6.4

I'd really like to understand why mine isn't working. The craziest thing is that someone on another forum gave me a very simple example that works without a hitch. I copied the code and get the same error as mentioned before.

he form that it's connected to is "MyLibrary". The button is the Google looking button next to "BookTitle".

The craziest thing is that someone on another forum gave me a very simple example that works without a hitch. I copied the code and get the same error as mentioned before.

Copying others macro code without understanding it often leads to these kinds of errors. Part of the problem you are experiencing involves confusion over the word "form" because it can have multiple meanings. Base contributes to the problem by having a Forms area on the main database page. Actually, it should be Form Documents. Looking at the example you referenced, MyLibrary is the name of a form document. A form document is a collection of 1 or more Forms. Macro code often is not portable when it is written to work with a specific form document. One clue is whenever getByName() is used in the code you will likely have portability issues.

Looking at the example database you referenced, Open the form document MyLibrary in the Edit/Design mode.Near the bottom left of the screen is the Form Design toolbar. Select the Form Navigator (5th icon from the left) to open the Form Navigator dialog. In the Form Navigator dialog looking at the structure of the form document notice that the control BookTitle appears inside the Form named MainForm. I modified the macro code found at WebsiteButtons -> Module1 ->GoogleBookTitle to read:

But that has the least portability, because it requires 3 calls to getByName() to get the text you need.Here is an more portable version of the macro. Since the button is on the same form as the TextBox control named "BookTitle" this macro doesn't need to know the name of the form document or the form, it can obtain the form object from the button event.

UnklDonald418 wrote:Looking at the example database you referenced, Open the form document MyLibrary in the Edit/Design mode.Near the bottom left of the screen is the Form Design toolbar. Select the Form Navigator (5th icon from the left) to open the Form Navigator dialog. In the Form Navigator dialog looking at the structure of the form document notice that the control BookTitle appears inside the Form named MainForm. I modified the macro code found at WebsiteButtons -> Module1 ->GoogleBookTitle to read:

Now when I press the Google button to the right of BookTitle my web browser opens to a results page of a Google search on the text entered in BookTitle.

This did the trick. I really am trying to understand the underlying logic, not seeing where in the Navigator I see form "MainForm". I have the navigator open but not seeing anything with regards to "MainForm".

Thank you so much for the help. I'm sure I'll have 100x more macro related questions as I crawl through this project. Really appreciate it.

There is a Navigator for inspecting components of a document that appears on the Standard toolbar along the top of the screen. If the title of the dialog is just "Navigator" then you won't find what you need there.Right click on the form document MyLibrary and select Edit.To the left, along the bottom of the screen should be a row of icons, including Select and Design Mode On/Off, Form and Form Navigator. If you don't find those icons then select View>Toolbars>Form Design so that there is a check-mark in front of Form Design.The 1st entry on the Form Navigator dialog is Forms. This is an important tool that allows you not only to inspect, but to edit all the elements on a form document. Right click on a control in the Form Navigator and select Properties to open the Properties dialog for that control.

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.7 & LibreOffice 6.1.5.2 - Windows 10 Professional

UnklDonald418 wrote:There is a Navigator for inspecting components of a document that appears on the Standard toolbar along the top of the screen. If the title of the dialog is just "Navigator" then you won't find what you need there.Right click on the form document MyLibrary and select Edit.To the left, along the bottom of the screen should be a row of icons, including Select and Design Mode On/Off, Form and Form Navigator. If you don't find those icons then select View>Toolbars>Form Design so that there is a check-mark in front of Form Design.The 1st entry on the Form Navigator dialog is Forms. This is an important tool that allows you not only to inspect, but to edit all the elements on a form document. Right click on a control in the Form Navigator and select Properties to open the Properties dialog for that control.

Nice! Thank you again.

On the same topic now, thought about creating a new thread but it's the same issue. I've successfully made buttons for "Book Title" and I'm moving to the dropdown menu of authors. Hitting another snag and I'm unclear why.

I'm not sure why you got that error message because DrawPages isn't the issue here.I copied you macro code into my copy of your database and connected it to the Approve Action event for the Goggle button to the right of the box containing the author's name. I get a NoSuchElementException. Again, using the Form Navigator look for a control named Author. There isn't one!With the Form Navigator still open, select the box on your form that contains the author's name.Now look in the Form Navigator and notice the the highlighted item is "List Box 1".Replace "Author" with "List Box 1" and give it a try.Uh-oh a different error message. Property or Method not found: TextThis is where learning to use the the MRI tool is essential if you want to write macro code.If you inspect the ListBox control using MRI you will see that it has no Text property, thus the error message.Looking through the list of properties there is something that looks promising, CurrentValue, and looking to the right in the MRI dialog there is the author name for the first record in your database.Replace Text with CurrentValue and try your macro again.

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.7 & LibreOffice 6.1.5.2 - Windows 10 Professional

That is interesting. I tested the macro in LO and confirm the CurrentValue returns 11. Using MRI I see no easy way to get the name needed for the search.When I run the macro in AOO 4.15 CurrentValue returns "Maxine Hong Kingston" and the macro works as expected.

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.7 & LibreOffice 6.1.5.2 - Windows 10 Professional

What I'm wondering is if there's a way to do a sql search in the macro to search the Authors table to match the Author's name based on the AuthorsID that is returned in LibO. Any thoughts on that approach? I'm going to report a bug with LibO about .CurrentValue returning the wrong value.

Finding: I included nearly identical code for "Series" and connected the new macro ("GoogleSeries") to the appropriate button under the book series. In OOo this is returning the SeriesID and not the SeriesName! This is identical to the behavior in LibO for Series AND identical to LibO for the Author but inconsistent compared to the behaviour that we previously discussed (Author in OOo works fine).

UPDATE: Cannot reproduce but at least on one occasion OOo returned AuthorID instead of AuthorName.

Last edited by jmadero on Wed Jul 18, 2018 4:54 pm, edited 3 times in total.

SelectedItems is the dropdown I think, as for the "(0)", I'm not sure why it's 0 vs. some variable to pass AuthorID forward. Any explanation appreciated. I'm not a programmer by trade but I try to understand and learn so I can avoid bothering everyone in the future.

Multiselection is one of the properties of a ListBox. 99% of the time that is set to No, but there are some rare situations where someone needs to select more than on item from a ListBox. To accommodate that situation SelectedItems is an array http://www.openoffice.org/api/docs/common/ref/com/sun/star/awt/UnoControlListBoxModel.html#SelectedItemsArrays in OpenOffice/LibreOffice begin with element 0 so an array with five elements will be numbered 0,1,2,3,4. When Multiselection is set to No there is only one array element, 0.If you use MRI to inspect oControl and double click on SelectedItems it will display something like (000) = 2 where the left side in parentheses is the array index and the right side is the actual value. So, in this case