Solved

Last Question about PowerPoint macros (honest!)

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Cancel future meetings from user mailboxes in Office 365 using Remove-CalendarEvents
Ever wonder what it's like to get hit by ransomware? "Tom" gives you all the dirty details first-hand – and conveys the hard lessons his company learned in the aftermath.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

626 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