If I print emails I typically only want the first page. To do that in Outlook takes a few clicks each time.
To make printing just the first page easier I created a macro. You can’t record macros in Outlook, so I used the SendKeys commands, which mimics key strokes.
ADDED 9 April 2022 – seems a recent update to OUTLOOK has stopped this macro from working. I am am investigating.
ADDED 10 April 2022 – big thanks to Jan Karel Pieterse an Excel MVP who made some great suggestions to get around this new issue. The code is a bit longer as it uses multiple Tab key presses to access different options. He also provided a new GetKeyState code for the top.
The macro works for me – no guarantees it will work for you, but fingers crossed. The new solution avoids using the Alt key which isn’t recognised in the latest Outlook version.
The macro works whether you have an email selected in the email list, or whether it is the current, open email. It will open the email if it is selected in the email list.
Please let me know how you go.
Option Explicit #If VBA7 Then Private Declare PtrSafe Function GetKeyState Lib "USER32" (ByVal vKey As Long) As Integer #Else Private Declare Function GetKeyState Lib "USER32" (ByVal vKey As Long) As Integer #End If Sub New_Print_One_Page() SendKeys "{ENTER}" SendKeys "^p" SendKeys "{TAB 11}" SendKeys "{ENTER}" SendKeys "{TAB 3}" SendKeys "1" SendKeys "{ENTER}" If GetKeyState(vbKeyNumlock) = 0 Then SendKeys "{NUMLOCK}", True End If End Sub |
ADDED 13 April 2022 – yet another solution from someone in the comments. See which one works for you.
This macro doesn’t open the email if printing from the list.
Option Explicit #If VBA7 Then Private Declare PtrSafe Function GetKeyState Lib "USER32" (ByVal vKey As Long) As Integer #Else Private Declare Function GetKeyState Lib "USER32" (ByVal vKey As Long) As Integer #End If Sub New_Print_One_Page() SendKeys "^p" SendKeys "%FPR" SendKeys "%S" SendKeys "1" SendKeys "{ENTER}" If GetKeyState(vbKeyNumlock) = 0 Then SendKeys "{NUMLOCK}", True End If End Sub |
Added 6 March 2020 – The latest code I use, which handles the Number Lock issue, is below. This may be affected by 32 bit vs 64 bit versions.
Added 9 April – as at this date the code below might not work in the latest subscription version of Outlook. The solution is above.
Option Explicit #If VBA7 Then Private Declare PtrSafe Function GetKeyState Lib "USER32" (ByVal vKey As Long) As Integer #Else Private Declare Function GetKeyState Lib "USER32" (ByVal vKey As Long) As Integer #End If Sub Print_One_Page() SendKeys "%FPR" SendKeys "%S" SendKeys "1" SendKeys "{ENTER}" If GetKeyState(vbKeyNumlock) = 0 Then SendKeys "{NUMLOCK}", True End If End Sub |
Outlook macros are a bit different to set up than Excel, so I have done a video to show you the steps. The macro is below with the steps to install underneath.
Warning: Once you install the macro Outlook will ask you to enable macros each time it opens.
Second Warning: This technique may affect your Num Lock setting – it does mine, but I still use it.
This macro works for Outlook 2010. Old code.
Sub Print_One_Page() SendKeys "%FPR" SendKeys "%S" SendKeys "1" SendKeys "{ENTER}" End Sub |
Installation steps
- Copy the code above
- In Outlook press Alt + F11 to open the VBA window
- Double click the ThisOutlookSession on the left of screen
- Copy the code from above and paste into the code window on the right of the VBA screen – see image below.
- Close the VBA Window
- Click the File tab, click Options, then click Quick Access Toolbar option on the left
- In the drop down select Macros
- Select the Print_One_Page macro and click the Add button – see image below.
- On the right of screen select the macro at the bottom of the list and click Modify – see image below.
- Select an icon and click the OK button and click OK to finish
- When you close Outlook after installing the macro it will ask you whether to save the changes – make sure you save them.
Clicking the icon (yellow smiley face) will print just the first page of the selected or current email.
Added 2nd May 2013 – the image below shows my macro security settings in Outlook 2013. (File Tab > Options > Trust Center > Trust Center Settings button)
Related Posts
Thanks for this. However this macro worked fine until I closed Outlook. Then it didn’t work again. Stepping into the macro it said “macros for this project are disabled”. The settings in the trust centre are still the same. How is this fixable.
In the Trust Center you need to have the Macro setting set to Notifications for all macros – then when you start Outlook a dialog is displayed asking you to enable macros.
Thanks for your response! I had it on this setting already but it didn’t seem to make any difference. I self-certified the macro for a digital sig and then for some reason it started working. When I tried running the macro is wanted me to trust the publisher, which I did and then it seemed to work again. Peculiar! Anyway, very good macro!
I just added a Second Warning – this technique can affect the Num Lock status. Apparently its a bug with using Send Keys.
Yes, I just came back to ask about the Num Lock status issue. It’s worth putting up with, butI have seen some macro solutions involving GetKeyboardState command. Haven’t got it to work yet!
I had to set my macros in Outlook 2013 in the trust center to allow all macros before this would work. I don’t think this is very secure for my computer. What should I do?
I have it running in Outlook 2013 with notification. I wouldn’t allow all macros as you say it’s not secure. Maybe check the other security settings. I’ll check mine again.
Did you try using notification and logging out and logging in again? Some settings need to be set when loaded.
I updated the post with my macro security settings.
First, thanks so much for the macro, it has saved heaps of paper and time!
Can the macro be expanded to select a particular printer first? I have installed and named several versions of my printer, each with preferences set for a particular purpose e.g. FX C7775 black duplex stapled hole punch
I can change the default printer but unfortunately our work setup is such that at each login the default printer is set to colour, which is the most convenient for most printing jobs in our office.
Thnx
Liz
Sorry Liz – believe it or not Outlook VBA has no way to changes printers – it only uses the default printer.
Regards
Neale
I suspected so but think I have a half solution. I’ve created a macro and button for word to print from the colour printer, and added a Devices and Printers shortcut to my startup folder, hopefully it will remind me to change my default printer to the black one.
You could change the printer using the SendKeys function
%n will get you to the printer name drop down list, then you can send keys to get to the printer you want.
Does this work with Outlook 2013?
I have been using a slightly different version in Excel 2013.
Sub Print_One_Page()
‘ SendKeys “%FPR”
‘ SendKeys “%S”
‘ SendKeys “1”
‘ SendKeys “{ENTER}”
CreateObject(“WScript.Shell”).SendKeys “%FPR”
CreateObject(“WScript.Shell”).SendKeys “%S”
CreateObject(“WScript.Shell”).SendKeys “1”
CreateObject(“WScript.Shell”).SendKeys “{ENTER}”
If GetKeyState(VK_NUMLOCK) <> 1 Then CreateObject(“WScript.Shell”).SendKeys “{NUMLOCK}”, True
End Sub
Sorry all the code for the latest version is shown below.
Option Explicit
Public Const VK_NUMLOCK = &H90
Public Declare Function GetKeyState Lib “user32” (ByVal nVirtKey As Long) As Long
Sub Print_One_Page()
‘ SendKeys “%FPR”
‘ SendKeys “%S”
‘ SendKeys “1”
‘ SendKeys “{ENTER}”
CreateObject(“WScript.Shell”).SendKeys “%FPR”
CreateObject(“WScript.Shell”).SendKeys “%S”
CreateObject(“WScript.Shell”).SendKeys “1”
CreateObject(“WScript.Shell”).SendKeys “{ENTER}”
If GetKeyState(VK_NUMLOCK) <> 1 Then CreateObject(“WScript.Shell”).SendKeys “{NUMLOCK}”, True
End Sub
Thought I had found the answer I’d been looking for……
but when I use the macro, it doesn’t print, but instead it displays on screen all the hidden ‘notes’ and reminders from a program I use called TurboNote – how can I stop that happening?
Hi Andrew
Unfortunately it looks like the shortcut keys used in the macro conflict with your TurboNote program, so the macro won’t work – sorry.
Regards
Neale
Hello
I get emails from Paypal that have service@intl.paypal.com in the from field
The properties of the email however have a reply to email address embedded such as billsmith@yahoo.com so that when i select the email and hit reply it sends an email to billsmith and not paypal.
It there a way to have a macro that i can run that would do this and insert a template.
Outlook 2010
Windows 10
By the way, if i highlight the email and select reply it will reply to Paypal the email has to be opened first and then select reply so the reply-to email address is selected.
Regards
Hi Wil
Sorry my expertise is in Excel – the Outlook macro I shared was a solution I use to save paper and time. I thought others may find it helpful.
I think an Outlook macro could do what you want but my skill level is not up to it.
Maybe check out an Outlook VBA forum.
Regards
Neale
This is GREAT! You are saving me so much time and so many trees. Thank you!
Thanks Laura – macros rule.
The block num solution does not work with 64bit.
Did you have a 64 bit solution?
By the way great macro. Very nice!
See if this line of code works – I can’t test as I have 32 bit.
Declare Function GetKeyState Lib “user32” Alias “[COLOR=#ff0000]#1866[/COLOR]” (ByVal nVirtKey As Long) As Integer
I hope this tread is still active.
I am looking for this Print_one_page VBA-code suitable for Outlook Office 365 (cloud) for ages! Unfortunately non of the above mentioned options work . Maybe the codes used are too old?
It sometimes opens an e-mail only, but no printing a all (even not an error message).
Any idea how to solve this?
Thank you
Hello MH
The VBA solution will only work on the desktop version of Outlook. Sorry I have no experience with the cloud version of Outlook.
Regards
Neale
Hi Neale
Thank you for the macro – I have been using it for some time and recently when I click on the shortcut to print one page of an email, the email opens on a new page instead of printing one page.
Do you know what the issue could be?
Thank you
Hi Dylan
I am still using it and it is working ok for me.
The macro works by mimicing key stokes – the % sign is for the Alt key.
With the email open pressing
Alt then F P R in sequence
Then Alt S
then 1
Then ENTER
If any of those don’t do what you need, tweak the letters/numbers in the code
Hope that helps.
Neale
I’m having exactly the same problem with mine.
That’s frustrating – not sure what has changed.
Mine just started doing the same thing as Dylans yesterday? Worked fine the day before.
Got a solution for me see if it works for you – the number lock may be an issue.
Hi Neale,
Thanks so much for the code but I am having the same issue as well.
OK I have just updated and get the same result – leave it with me and I will see what I can do.
Early indications are not good – the Alt (%) key doesn’t seem to be recognised. Will keep looking.
Got a solution for me see if it works for you – the number lock may be an issue.
Got a solution for me see if it works for you – the number lock may be an issue.
Got a solution for me see if it works for you – the number lock may be an issue.
Got a solution for me see if it works for you – the number lock may be an issue.
Yes, Outlook doesn’t seem to be recognising the ‘Alt’ key for some reason. I will keep a look out on this forum for any potential solutions.
Thanks Neale.
Hey man, thank you so much for this but I have been using it for some time now and since today, all it does is pop out the email as if I double clicked it. It seems that is the motion that it is mimicking now. I don’t known if Outlook made a new update but it seems this is what is happening with this Macros.
Is there a new macros code I can use pleaseeee? This is really important and I don’t want to go back to the stone ages on this one page printing.
Got a solution for me see if it works for you – the number lock may be an issue.
Tried the new solution but nothing happens when I select the macro, no window pop up or anything.
any suggestions?
Hi George
Sorry there is not much I can do without doing a bit of trial and error on your system.
Regards
Neale
Hi Neale, the new one works now. Thank you so much. Although I was having issues when I had not removed the older macros I had on but I guess that has been sorted.
Thank you again
Hi Terry
That’s good to hear. I wasn’t sure if it would work for other people.
Regards
Neale
Hi again, I am trying to get this set up on other work computers which are still on Windows 10 while mine (which works) is on Windows 11 Pro. I think the function isn’t working on the others because it only pops out the “print page” page and that’s all. I am theorizing that this is new macros is for a windows 11 updated computer then? or could there be some other reason like the old macros still getting confused with the new one? Please help.
The code prints for me but does not limit to just page 1. Thank you for putting this out there. It was so helpful before.
That happened to me while I was tweaking it. I will do a video showing how I got this second version to work – its called trial and error. It might help you tweak yours – it might only take one more or less tab to do it.
Work for me on Windows 10. Thanks so much your time and efforts for the update Neale.
Hi Adrian Thanks for letting me know – glad it works.
Thanks for this posting. I had same problem for printing the first page. So I tried to follow your code, but it is working only one time when Outlook is started. And I found that below amended code is worked well now. I hope it is usefull to somebody. Once again, thanks for your great posting!
Sub New_Print_One_Page()
SendKeys “^p”
SendKeys “%FPR”
SendKeys “%S”
SendKeys “1”
SendKeys “{ENTER}”
End Sub
Thanks for sharing that works for me as well.
That’s probably a better solution.
The April 13 fix worked for me! Big relief
I tried lots of things
And based on the code of someone else came up with the following which works
Sub Print_One_Page()
SendKeys “{ENTER}”
SendKeys “^p”
SendKeys “+({TAB})”
SendKeys “{ENTER}”
SendKeys “{TAB 3}”
SendKeys “1”
SendKeys “{ENTER}”
SendKeys “{ESC}”
End Sub
Thanks for sharing – looks like there are a few options for people to try now.
Hey Neale!
I’m on Outlook 2019 & can’t find this to work . Thanks for the effort tho! When I use the highest script mentioned, It opens de print dialogue but doesn’t do the page 1 or Print action. Any ideas are more than welcome!
Hi Jesse
For Office 2019 try the older versions of the code they were working until a recent update to Office 365 which you may not have.
Also try the code at the bottom of the comments? There are a few more options there.
Regards
Neale
Thanks for updating these macros (the 13th April one works for me).
Glad you could find a solution – there are few options now.