Solved

Last Question about PowerPoint macros (honest!)

Posted on 2011-02-25
2
421 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

Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
PowerPoint is the go-to presentation software for millions of users around the world. Many presentations use basic text features but you can really make special text jump out of your slide by applying this bubble text design process. This article ha…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

832 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