Solved

Last Question about PowerPoint macros (honest!)

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Create high volume marketing opportunities using email signatures with these top 10 DOs and DON'Ts of email signature marketing.
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
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.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

705 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

17 Experts available now in Live!

Get 1:1 Help Now