Insert a random number number into a pre-designed Word doc 
Author Message
 Insert a random number number into a pre-designed Word doc

Hi folks,

Am having a bit of trouble with some form development
using MS Word.  Real basic, I've got a small form our
company wants us to use to document techincal support
escalations.

Trouble is, the front line techs are forging the
authorization numbers and spoofing us.  Would like to
create a simple text field containing a unique, random
number for each instance of the parent form.  But for the
life of me, I can't get the syntax right!

Any help out there?



Tue, 03 May 2005 04:24:18 GMT  
 Insert a random number number into a pre-designed Word doc
Hi Bill,

Here's a routine I wrote for a similar question:

Dim iCount As Integer
Dim iAlphaNum As Long
Dim Password As Variant
For iCount = 1 To 8
    iAlphaNum = Int((1 - 0 + 1) * Rnd + 0)
    ' for numbers
    If iAlphaNum = 1 Then
        Password = Password & Int((9 - 1 + 1) * Rnd + 1)
    ' for letters
    Else
        Password = Password & Chr(Int((90 - 65 + 1) * Rnd + 65))
    End If
Next iCount
MsgBox Password

HTH


Quote:
> Hi folks,

> Am having a bit of trouble with some form development
> using MS Word.  Real basic, I've got a small form our
> company wants us to use to document techincal support
> escalations.

> Trouble is, the front line techs are forging the
> authorization numbers and spoofing us.  Would like to
> create a simple text field containing a unique, random
> number for each instance of the parent form.  But for the
> life of me, I can't get the syntax right!

> Any help out there?



Tue, 03 May 2005 04:33:02 GMT  
 Insert a random number number into a pre-designed Word doc
Thanks Dave!

Just what the doctor ordered, did a slight variation on a
theme (changed variable names, tied to a command button)
and life is good.  Although some front line technicians
aren't going to be happy campers!  (evil laugh...)

Quote:
>-----Original Message-----
>Hi Bill,

>Here's a routine I wrote for a similar question:

>Dim iCount As Integer
>Dim iAlphaNum As Long
>Dim Password As Variant
>For iCount = 1 To 8
>    iAlphaNum = Int((1 - 0 + 1) * Rnd + 0)
>    ' for numbers
>    If iAlphaNum = 1 Then
>        Password = Password & Int((9 - 1 + 1) * Rnd + 1)
>    ' for letters
>    Else
>        Password = Password & Chr(Int((90 - 65 + 1) * Rnd
+ 65))
>    End If
>Next iCount
>MsgBox Password

>HTH



Tue, 03 May 2005 05:06:58 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Exclude specific numbers from random number generation?

2. Word macro stops firing after a random number of executions

3. Large number of list templates in a word 2000 doc

4. Page count in a Word 97 doc reverts to wrong number on close

5. PC DOCS doc number footer for Word 97

6. Random Number Generation isn't random if.....

7. Random number generator seems to be not random!

8. Inserting page numbers in footer with word automation

9. e-mail doc from word, pre-addressed

10. Insert an embedded word doc from access in word

11. Help!Getting random text strings, and getting random numbers up to a specific number.

12. function to evaluate each record and assign a random number when qualified

 

 
Powered by phpBB® Forum Software