Excel

Print all embedded charts

Ease of Use

Easy

Version tested with

2000, 2002 

Submitted by:

Justinlabenne

Description:

Print out all embedded charts that are stored on sheets within your workbook. The charts get printed each on their own sheet. 

Discussion:

If you have a workbook full of emebedded charts on your worksheets, this code will allow you to print each one on it's own sheet. The charts are printed by themselves, not with other worksheet data. It can be quite a time consuming chore to go through even a couple sheets and select the chart, and print it. This will save you from that headache. 

Code:

instructions for use

			

Option Explicit Sub PrintEmbeddedChartsOnEachSheet() Dim szASheet As String szASheet = ActiveSheet.Name Dim lChartObjCount As Long lChartObjCount = ActiveSheet.ChartObjects.Count With Application .ScreenUpdating = False On Error Resume Next Dim wks As Worksheet For Each wks In ActiveWorkbook.Worksheets Dim x As Long For x = 1 To lChartObjCount With wks .ChartObjects(x).Select .ChartObjects(x).Activate .PrintOut , , 1 End With Next x Next wks ActiveChart.Deselect With Sheets(szASheet) .Select .Range("A1").Select End With .ScreenUpdating = True End With End Sub

How to use:

  1. Open an Excel Workbook
  2. Copy the code
  3. Press Alt + F11 to open the Visual Basic Editor (VBE)
  4. Select INSERT > MODULE from the menubar
  5. Paste code into the right pane
  6. Press Alt+Q to return to Excel
  7. Save workbook before any other changes
 

Test the code:

  1. Go to TOOLS > MACRO > MACROS
  2. When the dialog appears, select {PrintEmbeddedChartsOnEachSheet}
  3. Press Run
 

Sample File:

PrintAllEmbeddedCharts.zip 9.56KB 

Approved by mdmackillop


This entry has been viewed 111 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express