ineedadedt
Board Regular
- Joined
- Jan 7, 2004
- Messages
- 163
Hi All,
I found a macro code and was trying to modify it below, but I know I am missing a very simple way to loop what I want it to do, but not sure how. I am using this in Word and I want to ask a question of how many pages(times) to run this macro, then paste a picture we would be using to do it. Below the code takes whatever is in the clipboard and pasting it. I need the code below to "take the answer and tell the paste and move to the next section part of the code" to loop until it's done.
Can anyone help me on this? Thanks in advance!
Sub Test1234()
Do
ok = True
no_of_copies = InputBox(Prompt:="Please enter the number of pages in this document.", Title:="Number of pages", Default:="1")
If IsNumeric(no_of_copies) = False Then
MsgBox Prompt:="Non-numeric value entered.", Title:="Invalid value entered"
ok = False
ElseIf no_of_copies < 1 Then
MsgBox Prompt:="Value less than 1 entered.", Title:="Invalid value entered"
ok = False
ElseIf no_of_copies > 1000 Then
MsgBox Prompt:="Value greater than 1000 entered.", Title:="Invalid value entered"
ok = False
End If
Loop Until ok = True
Selection.PasteAndFormat (wdPasteDefault)
Selection.MoveDown Unit:=wdScreen, Count:=1
Selection.MoveDown Unit:=wdLine, Count:=5
End Sub
I found a macro code and was trying to modify it below, but I know I am missing a very simple way to loop what I want it to do, but not sure how. I am using this in Word and I want to ask a question of how many pages(times) to run this macro, then paste a picture we would be using to do it. Below the code takes whatever is in the clipboard and pasting it. I need the code below to "take the answer and tell the paste and move to the next section part of the code" to loop until it's done.
Can anyone help me on this? Thanks in advance!
Sub Test1234()
Do
ok = True
no_of_copies = InputBox(Prompt:="Please enter the number of pages in this document.", Title:="Number of pages", Default:="1")
If IsNumeric(no_of_copies) = False Then
MsgBox Prompt:="Non-numeric value entered.", Title:="Invalid value entered"
ok = False
ElseIf no_of_copies < 1 Then
MsgBox Prompt:="Value less than 1 entered.", Title:="Invalid value entered"
ok = False
ElseIf no_of_copies > 1000 Then
MsgBox Prompt:="Value greater than 1000 entered.", Title:="Invalid value entered"
ok = False
End If
Loop Until ok = True
Selection.PasteAndFormat (wdPasteDefault)
Selection.MoveDown Unit:=wdScreen, Count:=1
Selection.MoveDown Unit:=wdLine, Count:=5
End Sub