Thank you, David but it doesn't seems to work:
This is my code
Sub testuserform()
sndPlaySound32 "soundfile.wav", SND_SYNC
UserForm1.Show
End Sub
My next appraoach is making a userform with two textboxes. I make the first one with invisible text.
When I open this it seems to be empty, but it still have focus. Can I after showing the userform make it change focus to the next textbox, being ready for the user to input his answer there.
How can I change focus - that is move the cursor (without having the user click or hitting TAB?
Regards
Torstein
Den Fredag, 19. september 2014 8.57 skrev "'David Smart' smartware.consulting@gmail.com [ExcelVBA]" <ExcelVBA@yahoogroups.com>:
Regards, Dave S
Have you tried telling the sound procedure to wait until the sound finishes before continuing code execution? (I.e. second parameter of SND_SYNC.)
This should delay the creation/display of the user form, which would mean that the user wouldn't be able to type in the textbox, because it wouldn't exist yet.
Regards, Dave S
----- Original Message -----Sent: Friday, September 19, 2014 4:33 PMSubject: Vedr: [ExcelVBA] Preventing keyboard use before userform showsHi Paul and thank you for your answer, but this did not help me.My English may prevent me from explaining this well, but to delay the userform with a wait-statement does not prevent the user from using the keyboard, writing the numbers before the userforms shows. And when it shows this numbers are in the textbox. In that way I can't test whether they remember the numbers.Can I delete the keyboard buffer in an easy way before the userform is shown, or can I delete any content in the userform textbox before the userform is shown?Thanks again!TorsteinDen Torsdag, 18. september 2014 12.33 skrev "Paul Vermeulen paul.vermeulen@vulcantech.com.au [ExcelVBA]" <ExcelVBA@yahoogroups.com>:
Hi TorsteinThe code to display the form executes as soon as the computer asks the sound to start playing, not necessarily when the sound has finished playing.Many ways to do this, but just insert a wait statement Application.Wait (Now() + "00:00:02") or use "sleep" as per http://www.ozgrid.com/forum/showthread.php?t=89193PaulFrom: ExcelVBA@yahoogroups.com [mailto:ExcelVBA@yahoogroups.com]
Sent: Thursday, 18 September 2014 4:43 PM
To: ExcelVBA@yahoogroups.com
Subject: [ExcelVBA] Preventing keyboard use before userform showsI'm making a memory test in Excel.I play a sound With some numbers and I want the user to Write the numbers in a userform after the sound have been played.But now the user is able to Write the numbers while the sound is playing, then this numbers appears in the one and only textbox I have in the userform.Can I prevent this?Here is my code:sndPlaySound32 "D:\data-filer\data\yrkespsyk\tallhukommelse\lyder\" & lydfilnavn, 0&UserForm1.ShowThanks in advanceTorstein
No virus found in this message.
Checked by AVG - http://www.avg.com/
Version: 10.0.1432 / Virus Database: 4015/7732 - Release Date: 09/18/14
__._,_.___
Posted by: Torstein Johnsen <sejohnse@yahoo.no>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (6) |
Improvements in Yahoo Groups Search
Searching for new groups to join is easier than ever. We've honed our algorithm to bring you better search results based on relevance and activity. Try it today!
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
.
__,_._,___
Tidak ada komentar:
Posting Komentar