Macro for creating question answer dialog

I want to have a dialog macro like below
After showing a question and its four answers with the help of a dialog, on selecting one of the answers, that have to go to the next question.with this idea i was Searching in the internet , I found a file very nicely with a Microsoft Excel VBA macro, exactly as I intended. When I run it with Libre office calc it works fine the first time, When turned off and on again it gives the error
I am attaching the file for your verification , can you please help me by correcting it

–
Kind regards,
Sainudheen C

This can be done without a single line of stupid Basic code but not in Calc. You need Base for this.

F6LDYOGGWDYTM8E.xls (44.5 KB)
Please be patient and open this file.

I open the file, click the button and nothing happens with LibreOffice 7 on Linux .

F6LDYOGGWDYTM8E.xls (17 KB)
Sir Pleas use this file , remember this works first time only

F6LDYOGGWDYTM8E.xls (17 KB)
Please check this

I can’t run this since I don’t have Excel (did not use it in 20 years). However, it looks awfully because it has multiple answers (e.g. HCF and LCM) in one cell.
You have to write special programs for any type of fuzzy setup. You must not expect that anybody can do it for you.

Sir this is running in libreoffice calc but one time only , second time the diolog is getting deleted.

OK, LO runs that stuff on your machine (it doesn’t on mine). And what is your problem right now? You mean the dialog is removed from the containing document? Could this be intentional?

OK, I managed to copy your data into a database draft I had on disk since several months.
Multiple_Choice.odb (76.8 KB)

Download the document to a directory where it is allowed to execute embedded macros. It contains some 30+ lines of Python code.
A database consists of tables, queries, forms and reports. Forms and reports are user interface.
Open form “Personal Test”. Select the test named “question-answer-dialog/82926 @ 2022-10-15” clidk [–>], “log in” as user “Sainudeen”, click [OK].
Follow the instructions. Click next question on navi bar, click answer, [OK], click next question etc.
When done, open the “Resolve” form, select your name and test.

The database bundles questions and users in tests, so each user participating the same test gets the same questions. The database is just a rough and ugly draft. It should be able to store and handle dozends of tests and users with hundreds of questions and answers. Each question allows for multiple correct answers not only one.
WIth some improvements, it could handle many thousands of questions and answers, keep them stored in one place and comparable to each other.

1 Like

Actually, the code on this is a little clever…reminds me of code in magazines back in the 80s. This works perfectly if you load the xls then execute the Button1_Click code behind. But it does not work after a save/load cycle. I tried saving as xlsm and ods. In those cases it stops at the QForm.Show.

Sir, Sorry for the late reply
Could this be intentional? Don’t know sir.

Sir, Base file was downloaded and java error is coming in my system after correcting it I will let you know

Dear joshua4,
Yes you are very right that is the problem can’t save and reopen.

Hello, I will not fix the macros from MS Office, but you can try this Libre macro :-).
I put the number of actual question to the Title of dialog window, and there is count of answered questions in the Progressbar
test1.ods (15.7 kB)

1 Like

Dear, The file you gave me works very well, I appreciate you,