Consulting

Results 1 to 2 of 2

Thread: Print out all groups in a Active workbook

  1. #1
    VBAX Expert Shazam's Avatar
    Joined
    Sep 2005
    Posts
    530
    Location

    Print out all groups in a Active workbook

    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 ?




    [VBA]
    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


    [/VBA]



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



  2. #2
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    You can test for Groups instead of charts[VBA]Application.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[/VBA]
    K :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •