[Solved] Please help a newbie with a simple Calc macro

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
LabMan
Posts: 2
Joined: Fri Dec 05, 2008 3:12 am

[Solved] Please help a newbie with a simple Calc macro

Post by LabMan »

Hello everyone!

I am a total newbie to macros, and I am struggling with what is probably a very simple task.

Basically I have a OOOcalc spreadsheet with a column of roughly 500 cells, each containing a 7-digit number. I want to make a macro as follows:

There is an input box for the user to type in a number and hit enter.

If the number entered IS NOT in the spreadsheet's column, then the program beeps once and goes back to the starting input box for another number to be typed in. However if the number IS in the column then the program beeps three times and pops up a warning "NUMBER FOUND! Type OK to proceed!" and then they must type OK, at which point the program returns to the first input box and the whole process repeats.

Not doubt this is simple to the experts here but I have hardly managed to get past the "InputBox" and "Beep" functions! I'm also having trouble telling calc to look at the "whole column" rather than a defined range.

If someone could please help me with the code for comparing the input with the column, that would be great... if you could even write me a sample macro that does this it would be fantastic... I am out of my depth at the moment.
Last edited by LabMan on Sun Dec 07, 2008 1:39 am, edited 1 time in total.
OOo 3.0.X on Ms Windows XP
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Please help a newbie with a simple calc macro

Post by Villeroy »

Please use the spreadsheet as is. You have cell-validation, form controls, conditional formatting (instead of acustic beep), and various lookup functions at hand. From my personal experience I can tell that this kind of request leads to nowhere because there are inherent misunderstandings when it comes to the preconditions of such an application, let alone the conception of "easy".
Most recent example: http://user.services.openoffice.org/en/ ... =9&t=12713
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
LabMan
Posts: 2
Joined: Fri Dec 05, 2008 3:12 am

Re: Please help a newbie with a simple calc macro

Post by LabMan »

Thanks Villeroy, I developed a perfectly good solution just using conditional formatting. Thanks for your advice, have a good one.
OOo 3.0.X on Ms Windows XP
Post Reply