positioning input box

  • Thread starter Thread starter Marge S
  • Start date Start date
M

Marge S

I am trying to position a VBA input box so that it appears on the PowerPoint
screen in a certain place and won't interfere with underlying material. I
have followed the code examples but it keeps showing an error. How would you
write a statement to get input from a user ... say their name that you want
to store in userName variable and make sure the input box is at xpos 4,000
and ypos 5,000 and get the program to except that without error?

Thanks for any help you can provide. The info in my books and online help
for VBA in PPT just does not explain it well or give you a written example.
The problem is the item right before you put in the x and y positions. I
think it is callinf for some string, but you can't seem to leave it out. One
time I put in my own name in quotes and that worked, placing my name in the
text input area of the input box; however, when I changed it to "my name" it
wouldn't take it. Go figure????
Thanks, Marge
 
I am trying to position a VBA input box so that it appears on the PowerPoint
screen in a certain place and won't interfere with underlying material. I
have followed the code examples but it keeps showing an error. How would you
write a statement to get input from a user ... say their name that you want
to store in userName variable and make sure the input box is at xpos 4,000
and ypos 5,000 and get the program to except that without error?

Sub GetInput()
Dim sInput As String
sInput = InputBox("Type your name in the box below:", _
"Your name?", _
"Default Text", _
4000, 5000)
If Len(sInput) > 0 Then
MsgBox "You entered: " & sInput
Else
MsgBox "You canceled or entered nothing"
End If
End Sub
 
Thank you very much! It works perfectly. I think my mistake was that I kept
adding prompt:= in the InputBox command because I had all of the other
parts and it just wasn't working. It acted as if the string I used for the
default text was causing a problem.
Marge S
 
Thank you very much! It works perfectly. I think my mistake was that I kept
adding prompt:= in the InputBox command because I had all of the other
parts and it just wasn't working. It acted as if the string I used for the
default text was causing a problem.

You're welcome.

I'd guess you were using the alternate syntax, which works but seems a bit
fussier:

sInput = InputBox(prompt:="Prompt text", _
Title:="Here's the title", _
xpos:=2000, ypos:=3000)
 
What Steve said and ...

The := syntax is valuable if you forget what order the procedure wants
the parameters (does xpos go first or ypos), but I don't think you can
mix the the two versions. If you use := for one parameter, you have to
use it for all the parameters. The := syntax is particularly helpful on
the Mac, which doesn't prompt you for what parameter comes next.

--David

--
David M. Marcovitz
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
The := syntax is valuable if you forget what order the procedure wants
the parameters (does xpos go first or ypos), but I don't think you can
mix the the two versions.

Ah, thanks for grabbing that loose thread.
If you use := for one parameter, you have to
use it for all the parameters. The := syntax is particularly helpful on
the Mac, which doesn't prompt you for what parameter comes next.

VPC and a copy of PPT for Windows is even handier on the Mac. <g>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top