Log in

View Full Version : Advice needed - Voting Program in PowerPoint and write results to Excel?



ilikered100
05-14-2018, 09:51 AM
I'm looking for some general advice on how to proceed with a project. A little background first. I've done a lot of programming in Excel and Access with VBA and a little SQL too. I'm also a fairly advanced PowerPoint developer, but I haven't ventured into VBA programming with PowerPoint... yet.

I work at an Elementary School and I'd like to develop a voting program where students can vote for their school officers. What I would like to do, but I'm not sure it's possible, is use PowerPoint where there are pictures of candidates on a slide and when a student clicks on a picture it "writes" the data to an Excel spreadsheet (or other place that can compile and hold the data) as students are voting. Basically, counting the number of clicks for each candidate. I have no idea if this is possible in PowerPoint... to write data real-time to Excel. If it is, I'll start down the road of developing it, but maybe it should be done in Access using forms or another program. The reason I'm hoping it can be done in PowerPoint is that it will be more easily editable if others with less programming experience want to use it and edit it... we often share tools we've developed between schools. Whatever software is used, the program cannot be done using a web based solution as we are not aloud to put student pictures with names online.

Just to give a few more specifics on how the program would run (if possible). After an opening slide (something like "Click here to begin voting") there would be one slide for each office. The first slide would have pictures and names of all the candidates for President. When a student clicks on the candidate they want for President, it would take them to the next slide of Vice President, etc. When a student has been through all the slides/offices, it would go back to an opening slide where the next student could start voting and go through the slides/offices again. On the computer where this is installed, when a picture is clicked it would add 1 to the total for the candidate that was selected...hopefully in Excel... again, if this is even possible. If the data could be written to a text file that would work also, but Excel would be better obviously.

Any advice is appreciated. I just didn't want to spend an inordinate amount of time trying to develop something that isn't possible. If you have an idea of another program to use to develop this, I'm open to that also.

Hope this made sense.

Thanks,
Carolyn

Paul_Hossler
05-15-2018, 07:47 AM
Q: Multiple students voting simultaneously each with PP open on their PC and writing to a single instance workbook on a server(?)

or


Q: A voting booth paradigm where students queue and take turns at a single instance of PP?

ilikered100
05-15-2018, 08:04 AM
Hi Paul,
It could be either, but I think for now the second option is what I'm thinking of... where students would be in line basically to vote at the same computer... so the PowerPoint would loop back to the beginning when one student finished voting and the PowerPoint would be ready for another student to go through it again. The data would be written locally to that computer (not a server).

Your first option would probably be better, but I think for right now... writing to a workbook on the local computer is best.

Do you think this is possible... to do?

Thanks,
Carolyn

Does this make sense?

SamT
05-15-2018, 11:24 AM
IMO, Option 2 is much easier.

IM-inexperienced-O, Option1 would require writing to Access, then exporting the result to Excel. Or Word or ???


On third thought, if PP has Class Modules, A CM can hold all a Student's choices and pass them to a single Networked Excel CM. The xlCM would need a Ready Property and the ppCM would need to wait for a Ready from the xlCM. Since the likelihood of two or more students finishing at exactly the same millisecond is very low, there should be no problem. I have written xlCMs that operate in microseconds with large Arrays

ilikered100
05-16-2018, 10:55 AM
Hi SamT,

Thank you for your response, but I think your solution (PP Class Modules) is going to be above of my level of expertise. I have a cursory understanding of your explanation, but I don't think enough to design and implement.

Not sure if you would be willing to explain with a bit more detail about your response to Option 1 about "writing to Access." I would need a little more information if that's possible in this forum/setting.

Lastly, I'll just ask... am I trying to do this (create a voting program) in the wrong application? Maybe it's really not feasible to do it in PowerPoint?

Thanks again for your response.

Carolyn

SamT
05-16-2018, 12:49 PM
Carolyn,

I have no experience with PowerPoint and very little with Access.

I do see that a few PP and Access experts are following this thread. Perhaps some of them will contribute.

One possible algorithm for an Excel interface could resemble


Declare Votes As Dictionary
Fill Votes Keys with Teacher Names

Property Let VoteFor(TeacherName As String)
Votes.TeacherName.Item = Item + 1
End Property

Public Procedure EndVoting()
Export Sum of all Vote.Keys and .Items to Excel
End Procedure


PP would use this like

Dim Exl As Application, etc
Set Exl = Networked Excel Workbook with Class Module (Edit: or ThisWorkbook Code)
On TeacherImage.Click...
Exl.CMName.VoteFor TeacherName
And
Exl.CMName.EndVoting


In Fact, THisWorkbook is a Class Module, so it could take that code, then PP's output could be

Exl.VoteFor TeacherName
And
Exl.EndVoting

Paul_Hossler
05-16-2018, 07:43 PM
Here's a Proof of Concept PP

Doesn't save anything and it's ugly

It does allow a user to pick candidates for 3 offices, and right now it just displays the choices at the end.

It just uses just basic PP actions to take action on a clicked picture, no class modules, etc.

Slide 1 - Click "Ready" and go to next (Ready needs to initialize things)

Slides 2, 3, and 4 - click pictures (change which one is clicked works)

Slide 5 - Click "Done" (where the saving would be done) and exit or click "Home" to restart

Paul_Hossler
05-17-2018, 07:05 AM
This is a slightly more polished (less crude) version that uses the Office in the slide title placeholder instead of the .SlideIndex

SlideIndexes can change, so I don't like to rely on them