MS Office Forum / General PowerPoint Questions / October 2007
Removing info from text box once it's saved to a file
|
|
Thread rating:  |
Serge M. - 03 Oct 2007 22:06 GMT Hi everyone,
I'm trying to set up a presentation slide on my touch-screen monitor where people can type their contact info in the text-box by using the on-screen keyboard. The problem I'm stuck with is that once the user hits the button SAVE and the info is sent to my file, this info still stays in the text-box. Is it possible to make it dissapear once it's saved, so next users can also type their info?
Currently I use this routine to send info from the text-box to a file:
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
What and where should I insert in this code to make info dissapear once it's saved?
Thank you and would really appreciate your suggestion, Serge
Steve Rindsberg - 04 Oct 2007 02:14 GMT Already replied to this earlier but here goes again:
> I'm trying to set up a presentation slide on my touch-screen monitor where > people can type their contact info in the text-box by using the on-screen [quoted text clipped - 4 lines] > > Currently I use this routine to send info from the text-box to a file: Sub SaveMe() ' ALL ON ONE LINE: Call WriteStringToFile("C:\Temp\Infofile.txt", ActivePresentation.Slides(1).Shapes("TextBox1").OLEFormat.Object.Text)
' add this after writing the text to file: ActivePresentation.Slides(1).Shapes("TextBox1").OLEFormat.Object.Text = ""
End Sub
> Sub WriteStringToFile(pFileName As String, pString As String) > Dim intFileNum As Integer [quoted text clipped - 9 lines] > Thank you and would really appreciate your suggestion, > Serge ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================
Serge M. - 04 Oct 2007 07:37 GMT Hi Steve,
Thank you - it works now.. but how to make the info typed and saved by different users accumulate in my file - right now the info saved by the last user substitutes the info that was saved there before.
Thank you,
Serge
> Already replied to this earlier but here goes again: > [quoted text clipped - 36 lines] > PPTools: www.pptools.com > ================================================ John Wilson - 04 Oct 2007 08:26 GMT Try this change to your code
Open pFileName For Append As intFileNum
 Signature Amazing PPT Hints, Tips and Tutorials- http://www.PPTAlchemy.co.uk http://www.technologytrish.co.uk email john AT technologytrish.co.uk
> Hi Steve, > [quoted text clipped - 46 lines] > > PPTools: www.pptools.com > > ================================================ Serge M. - 04 Oct 2007 20:04 GMT Thank you John,
It works fine now. Is it possible to put a pop-up "Thank You" note appearing for 1-2 seconds when users clicks SAVE, to let them know that their info is accepted?
Best,
Serge
> Try this change to your code > [quoted text clipped - 50 lines] > > > PPTools: www.pptools.com > > > ================================================ Steve Rindsberg - 05 Oct 2007 05:51 GMT > Thank you John, > > It works fine now. Is it possible to put a pop-up "Thank You" note appearing > for 1-2 seconds when users clicks SAVE, to let them know that their info is > accepted? Settle for a message that they can read and click OK to dismiss?
Add this:
MsgBox "Thanks a bunch. Loved your answers. Click OK to make me go away"
----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================
Serge M. - 05 Oct 2007 06:54 GMT Thank you very much guys - all works fine! You are the best!
Steve, I'm sorry if it's too much to ask for, but is it possible instead of this standard pop-up text-box window, to have my own custom shape appear with words "THANK YOU.., etc." and button OK to dismiss it?
Thank you,
Serge
> > Thank you John, > > [quoted text clipped - 13 lines] > PPTools: www.pptools.com > ================================================ David M. Marcovitz - 05 Oct 2007 14:35 GMT MsgBox is the easiest, but if you want your own shape, you could use the AddShape method (ActivePresentation.SlideShowWindow.View.Slide.Shapes.AddShape) or you could create a shape in advance and hide it. When the time is right, have the shape become visible
ActivePresentation.Slides(5).Shapes("SecretButton").Visible = msoTrue
This makes a shape named "SecretButton" on slide 5 become visible. The code linked to that shape can be to make it invisible again (change True to False above). However, once you're going this route, you might as well go back to your original specification and have the shape become visible, wait 2 seconds and have the shape disappear. Example 8.4 on my site (http://www.PowerfulPowerPoint.com/) shows how to do the delay.
--David
 Signature David M. Marcovitz Microsoft PowerPoint MVP Director of Graduate Programs in Educational Technology Loyola College in Maryland Author of _Powerful PowerPoint for Educators_ http://www.PowerfulPowerPoint.com/
=?Utf-8?B?U2VyZ2UgTS4=?= <SergeM@discussions.microsoft.com> wrote in news:BC88747C-BE92-49D9-9AE6-D95CE4FCACE9@microsoft.com:
> Thank you very much guys - all works fine! You are the best! > [quoted text clipped - 27 lines] >> PPTools: www.pptools.com >> ================================================ Serge M. - 05 Oct 2007 18:46 GMT Hi David, I created a shape on another slide #2, called it SecretButton, inserted in my code the line ActivePresentation.Slides(2).Shapes("SecretButton").Visible = msoTrue, and it doesn't work - the shape does not appear when the SAVE buttone is clicked.
What do I do wrong?
Thank you, Serge
> MsgBox is the easiest, but if you want your own shape, you could use the > AddShape method [quoted text clipped - 44 lines] > >> PPTools: www.pptools.com > >> ================================================ David M. Marcovitz - 05 Oct 2007 19:13 GMT When you say that you called it SecretButton, how did you give it that name. As far as I know, the name has to be given with code (see Example 8.7 on my site). Now, you say that you inserted the shape and used the code, but if you didn't use code to hide the shape, it should already be visible. If it is not, you either didn't insert it, you put it off of the slide, or you set an entrance animation. The .Visible code doesn't trigger an entrance animation or move the shape, it just makes it show up in whatever place and whatever state it is in. --David
 Signature David M. Marcovitz Microsoft PowerPoint MVP Director of Graduate Programs in Educational Technology Loyola College in Maryland Author of _Powerful PowerPoint for Educators_ http://www.PowerfulPowerPoint.com/
=?Utf-8?B?U2VyZ2UgTS4=?= <SergeM@discussions.microsoft.com> wrote in news:6E165FA8-F1B2-468F-8291-B9A06416615D@microsoft.com:
> Hi David, > I created a shape on another slide #2, called it SecretButton, [quoted text clipped - 58 lines] >> >> PPTools: www.pptools.com >> >> ================================================ Serge M. - 10 Oct 2007 03:16 GMT Hi David, I'm a bit confused. What do you mean by "hiding a shape" - to create it on a new slide (let's say Slide 2)? And then create a new module with code you gave me(ActivePresentation.Slides(2).Shapes("SecretButton").Visible = msoTrue) and assign it to this shape? If yes, it doesn't work. How do I co-relate it with the click on shape SAVE on my 1st Slide?
Thank you,
Serge
> When you say that you called it SecretButton, how did you give it that > name. As far as I know, the name has to be given with code (see Example [quoted text clipped - 68 lines] > >> >> PPTools: www.pptools.com > >> >> ================================================ David M. Marcovitz - 10 Oct 2007 14:46 GMT If you have a shape named SecretButton, and that shape resides on Slide 2, then you can run a procedure, such as:
Sub HideSecretButton() ActivePresentation.Slides(2).Shapes("SecretButton").Visible = msoTrue End Sub
You could assign this procedure to some other button (possibly a button on slide 1, and the shape on Slide 2 would hide. By the way, don't do this in a new module. Multiple modules will just complicate things.
Look at Example 6.6 on my site for a simple example of hiding and showing shapes.
--David
 Signature David M. Marcovitz Microsoft PowerPoint MVP Director of Graduate Programs in Educational Technology Loyola College in Maryland Author of _Powerful PowerPoint for Educators_ http://www.PowerfulPowerPoint.com/
=?Utf-8?B?U2VyZ2UgTS4=?= <SergeM@discussions.microsoft.com> wrote in news:E41490E8-4C9B-475A-845B-E64B64C91348@microsoft.com:
> Hi David, > I'm a bit confused. What do you mean by "hiding a shape" - to create [quoted text clipped - 83 lines] >> >> >> PPTools: www.pptools.com >> >> >> ================================================ Serge M. - 10 Oct 2007 20:41 GMT Hi David, I have a shape SAVE on the first slide (the one one that send typed test to my file). So, I've added your procedure to the code assigned to this shape. Now it look like this:
Sub SaveMe() ' ALL ON ONE LINE: Call WriteStringToFile("C:\Temp\Infofile.txt", ActivePresentation.Slides(1).Shapes("TextBox1").OLEFormat.Object.Text) ' add this after writing the text to file: ActivePresentation.Slides(1).Shapes("TextBox1").OLEFormat.Object.Text = "" ' Substitute the path/file.ext you want to use above MsgBox "Thank you"
End Sub
Sub WriteStringToFile(pFileName As String, pString As String)
Dim intFileNum As Integer intFileNum = FreeFile Open pFileName For Append As intFileNum Print #intFileNum, pString Close intFileNum End Sub Sub HideSecretButton() ActivePresentation.Slides(2).Shapes("SecretButton").Visible = msoTrue End Sub
And I assigned this procedure to the shape SecretButton on a second file.
When I type text and click SAVE - nothing happents, the shape SecretButton does not appear.
I also tried to add same line with Falce - doesn't work.
Serge
> If you have a shape named SecretButton, and that shape resides on Slide > 2, then you can run a procedure, such as: [quoted text clipped - 99 lines] > >> >> >> PPTools: www.pptools.com > >> >> >> ================================================ David M. Marcovitz - 11 Oct 2007 15:07 GMT I guess I'm confused as to what you are doing. You have a procedure named "HideSecretButton" that has code to show the shape secret button. And, you said that you assigned the procedure to the SecretButton shape. That doesn't make sense. You need to click on a button that actually calls the code to show the SecretButton. If the secret button is hidden, it wouldn't make sense to have that code only called from the hidden button because you can't click on a hidden button.
Also, I see from your code that you are using Control shapes, not regular autoshapes. That might change things a bit.
--David
 Signature David M. Marcovitz Microsoft PowerPoint MVP Director of Graduate Programs in Educational Technology Loyola College in Maryland Author of _Powerful PowerPoint for Educators_ http://www.PowerfulPowerPoint.com/
=?Utf-8?B?U2VyZ2UgTS4=?= <SergeM@discussions.microsoft.com> wrote in news:1D99EFC1-ACEB-4E21-ABAD-3BF2C0F52386@microsoft.com:
> Hi David, > I have a shape SAVE on the first slide (the one one that send typed [quoted text clipped - 141 lines] >> >> >> >> PPTools: www.pptools.com >> >> >> >> ================================================ Serge M. - 11 Oct 2007 21:04 GMT Hi David,
I've re-analyzed your examples, and now it works fine. Great!
Thank you all very much for your help.. and patience.
Best,
Serge
> I guess I'm confused as to what you are doing. You have a procedure named > "HideSecretButton" that has code to show the shape secret button. And, [quoted text clipped - 154 lines] > >> >> >> >> PPTools: www.pptools.com > >> >> >> >> ================================================ David M. Marcovitz - 12 Oct 2007 14:17 GMT That's great! I'm glad you figured it out. Thanks for letting us know. --David
 Signature David M. Marcovitz Microsoft PowerPoint MVP Director of Graduate Programs in Educational Technology Loyola College in Maryland Author of _Powerful PowerPoint for Educators_ http://www.PowerfulPowerPoint.com/
=?Utf-8?B?U2VyZ2UgTS4=?= <SergeM@discussions.microsoft.com> wrote in news:A4984725-E653-4367-ADFA-ED311B503502@microsoft.com:
> Hi David, > [quoted text clipped - 5 lines] > > Serge Serge M. - 13 Oct 2007 00:31 GMT No problem! I have one more question. As you see in the below code, the shape "OK" appears when you click on button SAVE.. and dissapears when you click on that shape ("HideSecretButton" procedure). But it would be helpful to also have an option to make it dissaper by itself. I tried to play with your examples' codes, but it didn't work. Can you advise me on what procedure should I insert (and exactly where in this code?) to make this "OK" shape stay for 2 seconds and dissapear by itself?
My current code is:
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
Sub SaveMe() ' ALL ON ONE LINE: Call WriteStringToFile("C:\Temp\Infofile.txt", ActivePresentation.Slides(1).Shapes("TextBox1").OLEFormat.Object.Text) ' add this after writing the text to file: ActivePresentation.Slides(1).Shapes("TextBox1").OLEFormat.Object.Text = "" ' Substitute the path/file.ext you want to use above ActivePresentation.SlideShowWindow.View.Slide.Shapes("SecretButton") _ .TextFrame.TextRange.Text = "OK!" ActivePresentation.SlideShowWindow.View.Slide.Shapes("SecretButton").Visible = True End Sub
Sub WriteStringToFile(pFileName As String, pString As String)
Dim intFileNum As Integer intFileNum = FreeFile Open pFileName For Append As intFileNum Print #intFileNum, pString Close intFileNum End Sub Sub SetObjectName() Dim objectName As String If ActiveWindow.Selection.Type = ppSelectionShapes _ Or ActiveWindow.Selection.Type = ppSelectionText Then If ActiveWindow.Selection.ShapeRange.Count = 1 Then objectName = InputBox(prompt:="Type a name for the object") objectName = Trim(objectName) If objectName = "" Then MsgBox ("You did not type anything. " & _ "The name will remain " & _ ActiveWindow.Selection.ShapeRange.Name) Else ActiveWindow.Selection.ShapeRange.Name = objectName End If Else MsgBox _ ("You can not name more than one shape at a time. " _ & "Select only one shape and try again.") End If Else MsgBox ("No shapes are selected.") End If End Sub
Sub HideSecretButton() ActivePresentation.Slides(1).Shapes("SecretButton").Visible = False
End Sub
> That's great! I'm glad you figured it out. Thanks for letting us know. > --David [quoted text clipped - 8 lines] > > > > Serge David M. Marcovitz - 14 Oct 2007 16:32 GMT Something like this:
Sub SaveMe() ' ALL ON ONE LINE: Call WriteStringToFile("C:\Temp\Infofile.txt", ActivePresentation.Slides(1).Shapes("TextBox1").OLEFormat.Object.Text) ' add this after writing the text to file: ActivePresentation.Slides(1).Shapes("TextBox1").OLEFormat.Object.Text = "" ' Substitute the path/file.ext you want to use above ActivePresentation.SlideShowWindow.View.Slide.Shapes("SecretButton") _ .TextFrame.TextRange.Text = "OK!" ActivePresentation.SlideShowWindow.View.Slide.Shapes ("SecretButton").Visible = True
Wait2Seconds
ActivePresentation.SlideShowWindow.View.Slide.Shapes ("SecretButton").Visible = False
End Sub
Sub Wait2Seconds() waitTime = 2 Start = Timer While Timer < Start + waitTime DoEvents Wend End Sub
 Signature David M. Marcovitz Microsoft PowerPoint MVP Director of Graduate Programs in Educational Technology Loyola College in Maryland Author of _Powerful PowerPoint for Educators_ http://www.PowerfulPowerPoint.com/
=?Utf-8?B?U2VyZ2UgTS4=?= <SergeM@discussions.microsoft.com> wrote in news:F30476EF-75F3-4D92-8CA0-8FC855B59049@microsoft.com:
> No problem! > I have one more question. As you see in the below code, the shape "OK" [quoted text clipped - 92 lines] >> > >> > Serge Serge M. - 14 Oct 2007 19:48 GMT Hi David,
Thanks a lot - it works perfect!
I'm also trying to make a music track play throughout the whole presentation (I use MS Office 2007), so I guess I have to go to Animation -> Slide Transition -> Loop Until Next Sound.. and then Other Sound and choose a track in .WAV format? But how do I make several track keep playing in loop? And could you recommend a safe free converter site to convert MP3s (and other) into WAV? Should I post this question in a new thread, for others to get a tip too?
Thank you again, guys, you're very helpful..
Serge
> Something like this: > [quoted text clipped - 126 lines] > >> > > >> > Serge David M. Marcovitz - 15 Oct 2007 20:24 GMT You're out of my area of expertise. If no one responds in this thread, you might try a totally new thread as this is a totally new question. Most of the people who might know the answer probably stopped reading this thread several days ago, at the first sight of VBA code. --David
 Signature David M. Marcovitz Microsoft PowerPoint MVP Director of Graduate Programs in Educational Technology Loyola College in Maryland Author of _Powerful PowerPoint for Educators_ http://www.PowerfulPowerPoint.com/
=?Utf-8?B?U2VyZ2UgTS4=?= <SergeM@discussions.microsoft.com> wrote in news:8798A3D1-9D9F-4097-882B-E6EB106356DA@microsoft.com:
> Hi David, > [quoted text clipped - 147 lines] >> >> > >> >> > Serge Serge M. - 18 Oct 2007 02:22 GMT Hi David, I have a question: I just sent that working presentation to myself by email, and then opened it on another computer with enabled macros and Medium security, etc., and it doesn't work on this other comuter - doesn't even type in the textbox, doesn't bring up the SecretButton, etc. Do you know why? This other computer uses MS 2003, so maybe it's because of the Viewer? Should I create the whole thing from the scratch on it in PPT 2003?
Thank you in advance,
Serge
> When you say that you called it SecretButton, how did you give it that > name. As far as I know, the name has to be given with code (see Example [quoted text clipped - 68 lines] > >> >> PPTools: www.pptools.com > >> >> ================================================ David M. Marcovitz - 18 Oct 2007 15:56 GMT If it's opening with the Viewer, that would be the problem. The Viewer does not support macros. Also, if you set up macro security while the presentation was open, that could be another problem. Macro security affects a file at the time it is opened so opening the file and then changing macro security will not affect the open file; you have to close it and open it again. Recreating in 2003 should not solve any of your problems. --David
 Signature David M. Marcovitz Microsoft PowerPoint MVP Director of Graduate Programs in Educational Technology Loyola College in Maryland Author of _Powerful PowerPoint for Educators_ http://www.PowerfulPowerPoint.com/
=?Utf-8?B?U2VyZ2UgTS4=?= <SergeM@discussions.microsoft.com> wrote in news:B0075A54-0892-46B8-A7BF-3062E8737D78@microsoft.com:
> Hi David, > I have a question: I just sent that working presentation to myself by [quoted text clipped - 86 lines] >> >> >> PPTools: www.pptools.com >> >> >> ================================================ Serge M. - 19 Oct 2007 02:56 GMT Hi David, So, what should I do? I have created a perfectly working presentation for a test run on my computer with MS 2007, but for the actual event, I have to run it on another computer with MS 2003. Do you have any suggestions how to make it happen? Thank you,
Serge
> If it's opening with the Viewer, that would be the problem. The Viewer > does not support macros. Also, if you set up macro security while the [quoted text clipped - 95 lines] > >> >> >> PPTools: www.pptools.com > >> >> >> ================================================ David M. Marcovitz - 19 Oct 2007 14:33 GMT Unfortunately, I have only used 2007 a few times so I am not in touch with all the compatibility issues between 2007 and 2003. Perhaps, someone else can help you with that. The basic VBA stuff you are trying to do should be cross-compatible, but if it's not working, I don't know where to point you. --David
 Signature David M. Marcovitz Microsoft PowerPoint MVP Director of Graduate Programs in Educational Technology Loyola College in Maryland Author of _Powerful PowerPoint for Educators_ http://www.PowerfulPowerPoint.com/
=?Utf-8?B?U2VyZ2UgTS4=?= <SergeM@discussions.microsoft.com> wrote in news:A19D2B27-5A0B-4B20-82B2-198688EE911E@microsoft.com:
> Hi David, > So, what should I do? I have created a perfectly working presentation [quoted text clipped - 104 lines] >> >> >> >> PPTools: www.pptools.com >> >> >> >> ================================================ Serge M. - 19 Oct 2007 14:57 GMT I have re-created a sample in MS 2003, copied the code, played with it a little bit - and it seems to work so far. !
Thank you for your response anyway.
Cheers,
Serge
> Unfortunately, I have only used 2007 a few times so I am not in touch > with all the compatibility issues between 2007 and 2003. Perhaps, someone [quoted text clipped - 111 lines] > >> >> >> >> PPTools: www.pptools.com > >> >> >> >> ================================================ David M. Marcovitz - 19 Oct 2007 15:18 GMT Great news. Do you remember what you had to change in the code? That information would be helpful for others to know some of the compatibility issues between 2003 and 2007. Also, does the 2003 version work in 2007? --David
 Signature David M. Marcovitz Microsoft PowerPoint MVP Director of Graduate Programs in Educational Technology Loyola College in Maryland Author of _Powerful PowerPoint for Educators_ http://www.PowerfulPowerPoint.com/
=?Utf-8?B?U2VyZ2UgTS4=?= <SergeM@discussions.microsoft.com> wrote in news:25929205-B162-432B-8D3A-08ABCDCDFD33@microsoft.com:
> I have re-created a sample in MS 2003, copied the code, played with it > a little bit - and it seems to work so far. ! [quoted text clipped - 125 lines] >> >> >> >> >> PPTools: www.pptools.com >> >> >> >> >> ================================================ Serge M. - 23 Oct 2007 06:12 GMT Hi David,
I didn't change the code - as far as I remember, I just copied it into a new empty 2003 presentation, then I created new shapes for keyboard, save button and a secret button, assigned to each of them their names and procedures and - it worked!
Thank you,
Serge
> Great news. Do you remember what you had to change in the code? That > information would be helpful for others to know some of the compatibility [quoted text clipped - 130 lines] > >> >> >> >> >> PPTools: www.pptools.com > >> >> >> >> >> ================================================ Serge M. - 23 Oct 2007 06:16 GMT Oh yeah,
I haven't checked yet if 2003 version works in 2007. That's a good question. I'll check and post it.
Cheers,
Serge
> Great news. Do you remember what you had to change in the code? That > information would be helpful for others to know some of the compatibility [quoted text clipped - 130 lines] > >> >> >> >> >> PPTools: www.pptools.com > >> >> >> >> >> ================================================
|
|
|