Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    313
    Thanks
    0
    Thanked 0 Times in 0 Posts

    random number macro (Word XP/2002)

    My random number macro will not work... any suggestions? Worked fine in 2000.
    Sub MAIN a = 1000 b = 9999 num = Int(Rnd() * (b - a) + a) MsgBox "The random number is" + Str$(num)End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: random number macro (Word XP/2002)

    It works fine for me, after I added the DIM that I need because I always use Option Explicit

    Sub MAIN()
    Dim a As Integer, b As Integer, num As Integer

    a = 1000
    b = 9999
    num = Int(Rnd() * (b - a) + a)
    MsgBox "The random number is" + Str$(num)

    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •