I have written some code so that when a button on the word toolbar is pressed it asks you how many pages you want to insert and it works fine. But if you try to enter something other than a number then it comes up with a debug, which it should.

What i want to do is restrict the InputBox to only numbers and have been trying a few things but it doesn't work properly. Is there an easy way to do this? Also can i put a limit on the number that they can enter?


Dim counter
Dim NoOfPages As String
    NoOfPages = InputBox(Prompt:="Enter the number of additional pages you need", _
          Title:="No. of additional pages", Default:="Enter number here")
    If NoOfPages <> "0" & "5" Then
        MsgBox "You can only enter a number in this field"
 
    Else
 
        For counter = 1 To NoOfPages
Thanks in advance