Solved

Last Question about PowerPoint macros (honest!)

Posted on 2011-02-25
2
423 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

751 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