View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Zubair Zubair is offline
external usenet poster
 
Posts: 11
Default How to assign PRINT option to execute a macro

How can I assign PRINT option to execute a macro, used for printing page
numbers in a cell. Macro results a proper answer I require but only on
executing or playing macro. I want to use Print options of excel to execute
the following mentioned macro.

Sub Demo()
Dim TotalPages As Long
Dim pg As Long


TotalPages = ExecuteExcel4Macro("Get.Document(50)")
For pg = 1 To TotalPages
With ActiveSheet
.Range("BY3").Value = pg & " of " & TotalPages '<<< CHANGE HERE
.PrintOut From:=pg, To:=pg
End With
Next pg
End Sub


Kind regards,
Zubair