[Solved] [Impress] Counting correct answers with macro

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
wilfried
Posts: 4
Joined: Tue Jul 07, 2020 5:28 pm

[Solved] [Impress] Counting correct answers with macro

Post by wilfried »

I have a presentation with test questions. I would like to give the result (amount of good answers) It is multiple choice but I would like that after the answer one goes automatically to the next question (only one anser per wuestion)
Is iit possible to count correct answers by using a macro and then jump to the next question?
Any macro examples? I am new to this.

Tx
Last edited by Hagar Delest on Mon Jul 13, 2020 6:46 pm, edited 1 time in total.
Reason: tagged solved
linux mint libre office 6.4.
wilfried
Posts: 4
Joined: Tue Jul 07, 2020 5:28 pm

Re: [Impress] Counting correct answers with macro

Post by wilfried »

Thanks for the support. I found a working solution. I don
t look any further to go to the next question automatically. They can try all the answers and at the end they will see how many times they tried.
I post the code below if any one is looking for something similar.

Code: Select all

Global numberCorrect as integer
Global numberwrong as integer

Sub start
numberCorrect = 0
numberWrong = 0
End Sub

Sub Correct
numberCorrect = numberCorrect + 1
MsgBox "Well Done ,   you got   "  &   numberCorrect  &   "   correct anwers" & "." , , "Quiz"
End Sub

Sub Wrong
MsgBox "Sorry ,  that is incorrect,  you can try again or move to the next question" , , "Quiz"
numberWrong = numberWrong + 1
End Sub

Sub result
MsgBox " you got  "  & numberCorrect & " out of " &      numberCorrect + numberWrong   & " answers correct " & "." , , "Quiz results"
End Sub
Last edited by robleyd on Tue Jul 14, 2020 1:25 am, edited 1 time in total.
Reason: Added Code tags
linux mint libre office 6.4.
Post Reply