I am looking to create a sort of Quiz using Powerpoint and I would like to save the input given by the user.
For example: If I ask the question: What is your favorite color? When they answer the question and click the next button, I would like to save the value of the textbox and append it to an output file.
I already know how to get the value and write the value to a file.
What I am looking to do is a sort of loop.
Here is the pseudo-code:
foreach(Control c in CurrentSlide.Controls)
{
File.Append(c.Value);
}
This way, no matter what controls are on the form, I want to save the value of each and every control.
Is this possible in VBA? If not, do you have any generic solutions for this situation?
Here’s a more generic way of checking for each control on the slide, w/o knowing in advance how many there’ll be. This assumes that you’ve kept the default names assigned to control shapes (TextBox1, CheckBox1 and so on). If you want to change those, you’ll need to be sure that each TextBox has a name that includes at least one bit of string that’s unique to it and change the code accordingly. Siddarth has already supplied code for writing to files and you said you have that under control so I’m just Debug.Printing the values here to keep the example simple.