473,466 Members | 1,565 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Word Macros- adding a pause while auto typing.

3 New Member
Hiya,

I'm completely useless with Visual Basic but this should be pretty easy to do. This is regarding MACROS in Microsoft Word by the way...

Basically I want to open a word document and I would like a sentance to be typed letter by letter.

Then (here's what I am having trouble with) I would like it to pause typing for a given ammount of time EG. 15 seconds before it continues.

Then I would like it to continue writing... How can I put a pause in there?

All it is for is a live comedy routine I am devising whereby I talk to a computer... and it talks back letter by letter (hence the pause). It's that simple!

Your help would be amazing.

Thank you very much.

Jack
Jun 24 '07 #1
4 2002
Killer42
8,435 Recognized Expert Expert
This subject has come up before. You can try using the search box for key termns such as "Excel", "wait", "sleep", "pause", "delay" and so on.

But this thread may provide what you need. (I believe VBA is fairly consistent between Excel and Word, and Excel questions seem to come up more frequently.)
Jun 25 '07 #2
jackjack
3 New Member
I shall look into that. Thank you. BUT I honestly have NO clue about ANYTHING VB, this is the first time I have ever attempted it. My friend managed to program this, it types a sentace letter by letter:

I've also been told to look into Timer and DoEvents functions. but i wouldn't know where to put them in here :S

Expand|Select|Wrap|Line Numbers
  1. Sub testing()
  2.  
  3. Dim start As Single
  4. Dim message As String
  5.  
  6. message = "THIS IS THE FIRST BIT OF TEXT TO BE SPELT OUT."
  7. speedupper = 0.02
  8. speedlower = 0.005
  9.  
  10. Characters = Len(message)
  11.  
  12. Selection.Font.Name = "Impact"
  13. Selection.Font.Size = 35
  14.  
  15.  
  16. For i = 1 To Characters
  17.  
  18. start = Timer + Rnd((speedupper - speedlower + 1) * Rnd + speedlower)
  19.  
  20.     writing = Mid(message, i, 1)
  21.  
  22. Selection.TypeText writing
  23.  
  24.     Do While Timer < start
  25.         DoEvents
  26.     Loop
  27.  
  28. Next i
  29.  
  30. End Sub
Jun 25 '07 #3
jackjack
3 New Member
No problem.. cracked it!
Jun 25 '07 #4
Killer42
8,435 Recognized Expert Expert
No problem.. cracked it!
Glad to hear it. :)

However, I'd consider rewriting the calculation of the random delay, if I were you. That calculation looks quite suspect. I believe RND always returns a value between 0 and 1, and the number you feed it (the "seed") simply starts the sequence of pseudo-random values. The upper/lower business would generally be used a bit differently.

Anyway, have fun.
Jun 25 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: MSNEWS | last post by:
Hi I'm using the word.applicationclass within my vb.net application to convert some word documents to text files. Is there anyway I can disable macros whilst loading the document, in Word I...
4
by: svdh2 | last post by:
Dear All, I have lately strugled more and more with Access, what started as a simple database has brought me to the fundaments of Access. I need to transfer fields from various tables to a...
15
by: sparks | last post by:
They are wanting to use word to print out some cards 4 to a page preformatted stuff from an access database. the problem with this is they don't want to do the same card twice. How can setup a...
1
by: Simon | last post by:
How can I create a Macro in VB generated Word document. It would be nice to add a Button to to the Word Doc too...
0
by: Andy | last post by:
The question is in the title really. How can I programatically check from VB.net whether a word document contains macros? We basically want to reduce the chance of storing / dealing with any word...
1
by: asampath | last post by:
When you open a word document within Internet Explorer, the only toolbar displayed is the Reviewing toolbar. Is there a way to force IE to display the standard toolbar by default (without needing...
1
by: djames | last post by:
Hi Gurus! Our users are required to use a MS Word template for reporting. The template has many bookmarked form fields. We have written an ASP.Net (2.0) application to populate those fields...
1
by: RobertK | last post by:
I need to write a c# code that will open up word documents and delete all the macros in it. Can some one please give me a code example or any ideas on how to do this. I already know how to...
1
by: pnalla | last post by:
hi how to create a word documetn using Excel macros.. i have some code but it crating a word document but it isnot close properly whats the proble. please suggest me. thanks prasad
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.