PDA

View Full Version : Print out all groups in a Active workbook



Shazam
10-23-2005, 04:47 PM
I found this code from another forum and I do have a similar problem. This code below prints out all the charts in a active workbook. But problem is that I have charts that is group together. So when i run the code it prints it out twice. is there a way to print it out once ?

Or is there a way to print out all groups in a active workbook ?





Sub Print_All_Charts()

Application.ScreenUpdating = False
Dim Sht As Object
Dim Cht As ChartObject
For Each Sht In ActiveWorkbook.Sheets
For Each Cht In Sht.ChartObjects
Cht.Activate
ActiveChart.ChartArea.Select
ActiveWindow.SelectedSheets.PrintOut
Next
Next
End Sub






Note: I changed the attachment because from another forum I used that user file for this post I apologize for any inconvience.

Killian
10-26-2005, 08:42 AM
You can test for Groups instead of chartsApplication.ScreenUpdating = False
Dim sht As Worksheet
Dim shp As Shape

For Each sht In ActiveWorkbook.Sheets
For Each shp In sht.Shapes
If shp.Type = msoGroup Then
sht.PrintOut
Exit For
End If
Next
Next