How to add page numbers to macro

D

Designingsally

Hi I got macros to create a message box and i want the page number to
indicated when macros are run. Page number shd be inside the message box as
the macros are run this message ll display some message like
'Hi". Plus I want it show the page number. in the same message box like you
are in page 10 , 20 like that.
 
G

Greg Maxey

Something like this:

Sub ScratchMacro()
Dim oRng As Word.Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = "test"
While .Execute
oRng.Select
MsgBox "The word " & oRng & " on page " &
Selection.Information(wdActiveEndPageNumber) _
& " is selected"
Wend
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top