On-screen keyboard on PP 2003/2007 presentation?

G

Guest

Hi,

Is there a way to bring on an on-screen keyboard when clicking on a link on
the presentation, for users to type their info? And if there is, can I send
this info to a particular folder on my computer?

Thank you,

Serge
 
G

Guest

Thank you.
But, how to get the on-screen keyboard, if users need to leave their info?
 
S

Steve Rindsberg

Thank you.
But, how to get the on-screen keyboard, if users need to leave their info?

You could try something like this:

Add a textbox control
Doubleclick it to open the VB editor
Don't add anything to the Change event code it automatically creates for you.
Instead paste this below the End Sub

Private Sub TextBox1_GotFocus()
Shell "osk.exe"
End Sub

Now go into slide show view and click in the textbox control
 
G

Guest

I'm trying to do that, and as soon I click on the text control in a view
mode, the window pops-up saying: "Run-time error '5'. Invalid procedure call
or argument" with options to End or Debug.
What should I do?

Thank you,
Serge
 
S

Steve Rindsberg

I'm trying to do that, and as soon I click on the text control in a view
mode, the window pops-up saying: "Run-time error '5'. Invalid procedure call
or argument" with options to End or Debug.
What should I do?

Check to seee that you actually have OSK.EXE on your PC: choose Start, Run; type
OSK.EXE into the text box then click OK. Does that bring up an on-screen keyboard?

If not, do a file search for OSK.EXE ... if it's somewhere on your PC other than on
the path, you'll have to modify the VBA code to include the entire path to OSK.EXE

If it's not on your PC, you won't be able to run it, of course.

You could possibly create your own via a user form with buttons or other controls for
each letter you want to allow users to enter.

In theory you could even do it with shapes in PPT itself.

Add this to your VBA project:

Sub PseudoKeyboard(oSh As Shape)
' you'd actually use this to add the text to your
' text control, but for proof of concept, we'll
' just msgbox the text:
MsgBox oSh.TextFrame.TextRange.Text
End Sub

Assign this macro to a rectangle you've drawn on the slide.
Now select the rectangle and type A
Copy it, change the text to B
Copy it, change the text to C
... etc

Now try clicking each shape in slide show view
 
G

Guest

I have the OSK on my computer, but you know, I'd prefer to create my own
pseudo keyboard with shapes, because I couldn't find any good existing
add-ins for the touch-screen application (maybe you could recommend some?).

I'm sorry, should I add this to my VBA project when I double-click on my
text box?:
Sub PseudoKeyboard(oSh As Shape)
' you'd actually use this to add the text to your
' text control, but for proof of concept, we'll
' just msgbox the text:
MsgBox oSh.TextFrame.TextRange.Text
End Sub

Ant also, how do I assign this macro to a shape I've created?

Thank you,
Serge
 
G

Guest

Hi Steve,
It works. I assigned this macro (below) to the rectangles with letters, and
when I click on each rectangle in a slide-show view, the message box appears
with only this letter.. then I have to click OK to close it, and do the same
with the next rectangle, etc., i.e. a new message box appears for each letter
when I click on rectangles, not together as a text.

How do I make letters appear together as a text in the text box?

Thanks,
Serge
 
S

Steve Rindsberg

Hi Serge,

OK, next, use this instead of the first version of the subroutine:

Sub PseudoKeyboard(oSh As Shape)

Dim strShapeText As String

strShapeText = oSh.TextFrame.TextRange.Text

' MsgBox oSh.TextFrame.TextRange.Text
With ActivePresentation.Slides(1).Shapes("TextBox1")
.OLEFormat.Object.Text = .OLEFormat.Object.Text & strShapeText
End With

End Sub


"TextBox1" is the default name PPT assigns to the first text box control on a slide.
You may need to change the code above to match any changes you (or PPT) have made to the control's name.
 
G

Guest

Hi Steve,
I've just created a new macro (that you suggested below) and assigned it to
the rectangular with a letter - and it doesn't work, i.e. it does not type
this letter in the text box. I have only one text box on this slide, and it
looks like it's still named TextBox1. What should I do?

Thanks,
Serge
 
S

Steve Rindsberg

Hi Serge,

Please copy the actual code from your project and paste it here ... thanks.
 
G

Guest

Hi Steve,
This is what I have now.. (and the letter appears in the message box when I
click on the shape):

Private Sub TextBox1_Change()

End Sub

Sub PseudoKeyboard(oSh As Shape)
' you'd actually use this to add the text to your
' text control, but for proof of concept, we'll
' just msgbox the text:
MsgBox oSh.TextFrame.TextRange.Text
End Sub

Is that what you asked for?
 
S

Steve Rindsberg

Ah. You're still using the original test code I posted, w/o the changes I asked you to make.

This is what you should be using:

Sub PseudoKeyboard(oSh As Shape)
Dim strShapeText As String
strShapeText = oSh.TextFrame.TextRange.Text

With ActivePresentation.Slides(1).Shapes("TextBox1")
.OLEFormat.Object.Text = .OLEFormat.Object.Text & strShapeText
End With

End Sub
 
G

Guest

Actually, that's exactly what I did before, when you told me to substitute
and it didn't work (so, I put back the message box code). I've just done
again - it looks like this now:

Private Sub TextBox1_Change()

End Sub

Sub PseudoKeyboard(oSh As Shape)
Dim strShapeText As String
strShapeText = oSh.TextFrame.TextRange.Text

With ActivePresentation.Slides(1).Shapes("TextBox1")
.OLEFormat.Object.Text = .OLEFormat.Object.Text & strShapeText
End With

End Sub

....and it doesn't work - no text appears in the text box, for some reason...

Serge
 
S

Steve Rindsberg

Actually, that's exactly what I did before, when you told me to substitute
and it didn't work (so, I put back the message box code). I've just done
again - it looks like this now:

Copied/pasted into a new presentation here, added the needed "key" shapes with text in them, added a text box
control and it works fine.

Things to check:

- Macro security (set it to medium or low)
- You've drawn a "key" to click, assigned it a Run Macro: PseudoKeyboard action setting and typed text into it
 
G

Guest

It works on a new slide of a brand new presentation. But when I do it on an
xisting presentation - it doesn't. Why is that?
Thank you
 
G

Guest

Steve,
I found the reason - it works in another presentation but only when it's the
first file.

But how do I make the SPACE and BACKSPACE keys function properly? And how do
I make the SAVE button send the info typed in the textbox to a certain file
on my computer?

Thank you.
Serge
 
S

Steve Rindsberg

Steve,
I found the reason - it works in another presentation but only when it's the
first file.

First slide, you mean? Yes. The *example* code I posted assumed that the text boxes are on the first slide.

With ActivePresentation.Slides(1).Shapes("TextBox1")
But how do I make the SPACE and BACKSPACE keys function properly?

Space should work ok if you put a space into the shape as its text.
Modify your code to something like this to get Backspace to work (make the "key" shape text = Backspace"

Sub PseudoKeyboard(oSh As Shape)

Dim strShapeText As String
strShapeText = oSh.TextFrame.TextRange.Text

With ActivePresentation.Slides(1).Shapes("TextBox1")
With .OLEFormat.Object
Select Case .Text

Case Is = "Backspace"
' delete the last character
.Text = Left$(.Text, Len(.Text)-1)
Case Else
.Text = .Text & strShapeText
End Select
End With

End Sub
And how do
I make the SAVE button send the info typed in the textbox to a certain file
on my computer?

General-purpose routine for writing a string to a text file
http://www.pptfaq.com/FAQ00514.htm
 
G

Guest

SPACE function workes.
BACKSPACE - doesn't.

I typed BACKSPACE in the "key" shape and changes the code into your last
suggestion:

Sub PseudoKeyboard(oSh As Shape)

Dim strShapeText As String
strShapeText = oSh.TextFrame.TextRange.Text

With ActivePresentation.Slides(1).Shapes("TextBox1")
With .OLEFormat.Object
Select Case .Text

Case Is = "Backspace"
' delete the last character
.Text = Left$(.Text, Len(.Text)-1)
Case Else
.Text = .Text & strShapeText
End Select
End With

End Sub

...and it jst types "BACKSPACE" in the textbox when I hit the key.
What did I do wrong?
 
G

Guest

I read some of your seminars about VB on your website - pretty interesting..
I guess I'm getting a bigger picture, little by little..
1. BACKSPACE key issue. I have created a new module with the last code you
gave me, named it "Backspace" and assigned it to the BACKSPACE "key" shape.
Now this "key" doesn't type this word in the textbox, nothing happents, and
it doesn't delete the last character.

2. SAVE button issue. I read thru your "Geberal Purpose..." and did it all.
When I press F5 - the notepad pops-up with the text I inserted in the code,
and it sends it to the TEMP folder. 1) But it's all happening in VB, not on
the presentation. 2) Now, how to give the button SAVE a command to send the
text typed in the textbox right to that TEMP folder, without popping-up
anywhere, and emptying the text box?

Sorry if it sounds confusing - I just started with VB and not that strong
with your terminology. I really appreciate your help.

Thank you,
Serge
 

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

Top