On-screen keyboard on PP 2003/2007 presentation?

S

Serge M.

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
 
S

Serge M.

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

Serge M.

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

Serge M.

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
 
S

Serge M.

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

Serge M.

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

Serge M.

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

Serge M.

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

Serge M.

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
 
S

Serge M.

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

Serge M.

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?
 
S

Serge M.

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
 
S

Serge M.

Hi Steve,
It doesn't work.
1) Should this code be assigned to all "keys" or only to BACKSPACE "key"?:

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 oSh.TextFrame.TextRange.Text

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

I assign it to the BACKSPACE "key", and it still doesn't backspace.

2) I assigned my SAVE button's click action as Run Macro: SaveMe

Sub SaveMe()
' ALL ON ONE LINE:
Call WriteStringToFile("C:\Temp\BlahBlah.txt",
ActivePresentation.Slides(1).Shapes("TextBox1").OLEFormat.Object.Text)
' Substitute the path/file.ext you want to use above
End Sub

Sub WriteStringToFile(pFileName as String, pString as String)
Dim intFileNum as Integer
intFileNum = FreeFile
Open pFilename For Output As intFileNum
Print #intFileNum, pString
Close intFileNum
End Sub

.... and I changed the path to C:\Temp\Testfile.txt, and it doesn't save text
in this file.

Your On-screen Keyboard sample works fine. I can just use it for the
Backspace issue. But should I do with the SAVE issue?

Any suggestions?

Sorry for confusion,
Serge
 
S

Serge M.

Hi again Steve,

I've handled the BACKSPACE issue, but still cannot resolve the SAVE button
problem. Once I change the path/file.ext from your "C:\Temp\BlahBlah.txt"
(below), to my "C:\Temp\Infofile.txt", a little textbox pops-up saying
"Expected: expression".
I tried to read Help on that, but I'm still far from understanding stuff
like "..you may have forgotten to specify a value for a named argument.." and
how to correct that.

Do you know how to correct it? I just want the SAVE button to send the
contact info, users type in the textbox, to my "Infofile.txt" file, and once
it's saved there, the textbox on presentation should become empty again for
the next user. Is it possible?

Thank you for your patience,
Serge
 
S

Serge M.

Sure, but let's start by posting the exact code you have to date.

Hi, this is what I have to date:

Sub SaveMe()
' ALL ON ONE LINE:
Call WriteStringToFile("C:\Temp\Infofile.txt",
ActivePresentation.Slides(1).Shapes("TextBox1").OLEFormat.Object.Text)
' Substitute the path/file.ext you want to use above
End Sub

Sub WriteStringToFile(pFileName As String, pString As String)
Dim intFileNum As Integer
intFileNum = FreeFile
Open pFileName For Output As intFileNum
Print #intFileNum, pString
Close intFileNum
End Sub

Thank you..
 
S

Serge M.

Hi again, Serge
This on-screen keyobard seemed like the kind of thing that might be useful to more people so I've pulled some of the bits of code together in an example PPT file:

Add an On-Screen Keyboard to your presentation
http://www.pptfaq.com/FAQ00895.htm

Hi Steve,

I also thought that maybe you could post a similar "on-screen keyboard"
sample (as you suggest above) but with a shape "SAVE" (or "SUBMIT") and its
assigned macro to make it send the info from the text-box to a specified
file. That's the ultimate reason of having the on-screen keyboard - to
collect info, so it would be also useful for more people.

Thank you,

Serge

:
 
S

Serge M.

Hi Steve,
I'm sorry for the headache - I finally (!) found the reason (a syntax error)
that prevented that code to execute the command. The code works fine now.
But how to empty the text-box for the next user, once the info is saved?
E.g. if I try to collect attendies' contact info: how to make the info, that
was typed and submitted by one user, dissappear from text-box once this
info's been sent to my file, to let the next user type his/her info too?

Thanks again,

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