|
|
|
|
|
|
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:
|
- Open an Excel Workbook
- Copy the code
- Press Alt + F11 to open the Visual Basic Editor (VBE)
- Select INSERT > MODULE from the menubar
- Paste code into the right pane
- Press Alt+Q to return to Excel
- Save workbook before any other changes
|
Test the code:
|
- Go to TOOLS > MACRO > MACROS
- When the dialog appears, select {PrintEmbeddedChartsOnEachSheet}
- Press Run
|
Sample File:
|
PrintAllEmbeddedCharts.zip 9.56KB
|
Approved by mdmackillop
|
This entry has been viewed 111 times.
|
|