0 Replies - 7110 Views - Last Post: 01 March 2009 - 10:14 AM Rate Topic: -----

#1 HappyLibrary  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 01-March 09

VBA PowerPoint - Assigning a variable value to a textbox.

Post icon  Posted 01 March 2009 - 10:14 AM

Hi, I'm completely new to this, so apologies if this has ended up in the wrong forum, but I am hoping VBA falls under the catergory of VB6.

I'm currently trying to make a quiz in PowerPoint using VBA.

One of my aims is to have a user enter their name in a textbox, and then have it displayed in other various textboxes throughout the powerpoint (e.g. <Name>'s score). I can get the entered name to appear in a message box, but not in another textbox, as I just get an "Object required" error.

If someone could point out what I'm doing wrong I'd greatly appreciate it. I'm hoping it's something obviously simple that I've missed or forgotten to add in.

At the minute I'm just trying to get it to appear in one textbox on Slide14.

Sub NameBoxes()
'Changes displayed name on various slides
'To the contents of the input box on slide 2

Dim InputName As String
Dim NameDisplayBox As TextBox
InputName = Slide2.NameBox.Text

		If (InputName = "") Then
			MsgBox ("Please enter your name.")
			Valid = False
			Valid = True
			'Tests InputName variable has a value
			MsgBox (Slide2.NameBox.Text)
		End If

Slide14.NameDisplayBox.Text = InputName

MsgBox ("It's done")

End Sub

Slide14.NameDisplayBox.Text = InputName is always highlighted when I run the debugger, so I'm assuming it's something to do with that.
I'm also hoping to do the same with the user's score, so I'm assuming the process would be similar to display integer variables in a textbox also?

Thanks in advance.

This post has been edited by HappyLibrary: 01 March 2009 - 04:27 PM

Is This A Good Question/Topic? 0
  • +

Page 1 of 1