vba code printing documents

TrustPilot

starstarstarstarstar Excellent

  • Home
  • Courses
  • Promotions
  • Schedule
  • Formats
  • Our Clients

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » VBA code for printing documents

VBA code for printing documents

resolvedResolved · Medium Priority · Version 2003

Eoin has attended:
Excel VBA Intro Intermediate course

VBA code for printing documents

I would like to add some code at the end of a macro to print the excel page(s) I'm working on, could you please let me know how I do this?

RE: VBA code for printing documents

Hi Eoin, thanks for your query. The simplest way to get the code to do this is to record a macro of you printing the spreadsheet. Try this code at the end of your subroutine, it should print out the active worksheet:

ActiveWindow.SelectedSheets.PrintOut Copies:=1

Hope this helps,

Anthony


 

Excel tip:

Formst Excel to display leading zeroes

Select the cells that you want to have displaying leading zeroes.

From the 'Format' menu select 'Cells' (Or Right-click on the selected range and and select 'Format Cells').

In the 'Number' tab click on 'Custom' in the 'Category' window.

In the 'Type:' box enter zeroes that correspond to the size of the required number (eg 5 zeroes).

Click OK.

When you enter numbers into these cells, leading zeroes will be displayed.

eg 123 = 00123

View all Excel hints and tips


Server loaded in 0.07 secs.