Solved

Last Question about PowerPoint macros (honest!)

Posted on 2011-02-25
2
419 Views
Last Modified: 2012-05-11
With lots of useful help from experts my Powerpoint Quiz is looking great, I've even got it to write the results to a file !
Just one issue that cropt up thats got me stumped (again).

How do I read data from a text box (active X control) into a variable?

I've added a text box control (active X from the developer ribbon)  on a slide and renamed it NameBox

I have a button on the slide that moves to the next slide by running some code (below)

If the line Qname=NameBox.text is commented out the code works fine, but if not nothing seems to happen when the button is pressed.

All the variables are DIMed in the declarations section, and without this line (or with it commented out) everything works

Once again can I call on your kind expertise to show me where I have gone wrong ?


Sub Initialize()
    Total_Correct = 0
    Total_Questions = 0
    'Qname = Namebox.Text
    'MsgBox (Qname)
    PassingScore = 6
    RecordtoFile = True
    LogFileName = "C:\PPTQuizLog.qiz"
    ActivePresentation.SlideShowWindow.View.Next
End Sub

Open in new window

0
Comment
Question by:KCTS
2 Comments
 
LVL 23

Accepted Solution

by:
JSRWilson earned 500 total points
ID: 34978911
You can't just reference a textbox by its name.

Two ways to proceed.

EITHER

RIGHT CLICK the box in question >> View Code
If the project Explore window isn't open press CTRL R to open

You should see there the name of the slide object with the textbox something like Slide4. Note that this does not have to correspond to the actual slide number.

Use this to refer to the textbox

'Qname = Slide4.Namebox.Text

OR USE:

QName=Activepresentation.Slides(actual slide index).Shapes("NameBox").OLEFormat.Object.Text
0
 
LVL 70

Author Closing Comment

by:KCTS
ID: 34979591
OK thanks - that worked a treat

I have one more question which I will post which really will be my last on this topic....
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now