View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default How to put in a warning?

Dim Resp as long

resp = msgbox(prompt:="Really print?", buttons:=vbyesno)
if resp = vbno then
exit sub
end if

Right near the top of your code??


Teak wrote:

How do I put in a warning in the macro below, like:
"Is the printer ready?" and pause for an answer.
If "yes", macro continues
If "No", abort.

Thank you.

Sub PrintWithPgNumInTitleRow()
Dim NumPages As Long, Pg As Long
NumPages = ExecuteExcel4Macro("Get.document(50)")
ActiveSheet.Range("TotalPages").Value = NumPages
For Pg = 1 To NumPages
With ActiveSheet
.Range("PageNum").Value = Pg
.PrintOut from:=Pg, to:=Pg
End With
Next Pg
End Sub


--

Dave Peterson