Creating a Macro that will only print the current page

T

Tine202

I am having difficulty with this task. I am unable to record a macro that
will only print one page. I have created a faux macro and edited it to
include the following:

Public Sub PrintCurrentPage()
With Dialogs(wdDialogFilePrint)
..Range = wdPrintCurrentPage
..PrintToFile = False
..Execute
End With
End Sub

but it prints the entire document and not just the current page. Can anyone
help me with this. I am using Outlook 2003 on Windows XP.

Thanks in advance
 
F

fumei via OfficeKB.com

Application.PrintOut FileName:="", Range:=wdPrintCurrentPage

will print the page the Selection is on.
 
T

Tine202

Thanks - this worked great. Does anyone know of a place that may have
"canned" VB script that I can edit?

Many Thanks!
 
T

Tine202

Thanks - this worked like a charm. Does anyone know of a website that has
"canned" VB script for things like this? Maybe that I can edit.
 
D

Doug Robbins - Word MVP

First place to look is the Visual Basic Help facility, accessed by pressing
F1 when the cursor is after for example PrintOut

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
D

Doug Robbins - Word MVP

ActiveDocument.PrintOut Range:=wdPrintCurrentPage

will print the page on which the selection is located.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
Y

Yoram

I wrote a code to convert Plain Text e-mail messages to HTML.
************************************
Sub PlainText2HTML()
Dim olMail As Outlook.MailItem
' On Error Resume Next

Set olMail = Application.ActiveInspector.CurrentItem
olMail.Save
olMail.BodyFormat = olFormatHTML

End Sub
**********************************************

I would love to incorporate into it "Print page 1 only". Do you have the
code for it?

(I was unsuccessful in merging my code with yours...)

Thanks,

Yoram
 
D

Doug Robbins - Word MVP

Adding olMail.PrintOut will print the mail item.

According to the Outlook Visual Basic help file, the PrintOut method is the
only Outlook method that can be used for printing and it does not appear
that it takes any attributes as does the PrintOut method in Word.
Therefore, I think that it is all or nothing.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
G

Graham Mayor

This forum is for Word - ask your Outlook questions in the Outlook forum.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Graham Mayor

I suppose you could pass the message to a Word document and print the first
page from there?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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