Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing from Macro Shrinking Chart

Status
Not open for further replies.

Fr33dan

Programmer
Jun 28, 2007
79
US
I wrote this macro to print the data of many files. I do this by looping through a list of files and if the file has been tagged I import the data and print. The problem is that when the file prints one of the graphs shrinks a little bit. On one file it's not noticeable but after 30 files it's now much smaller than the other(which remains the same size). The graph that's shrinking is a Log graph if it matters
Code:
Sub printTaged()
    Application.ScreenUpdating = False
    first = True
    StartingPos = Range("Current_Aging_File").Value 'save starting Unit
    Range("Current_Aging_File").Value = 0   'reset unit to begining
    For i = 1 To Range("No_Aging_Files").Value - 1
        
        If (Range("Put_Path").Offset(i - 1, 2).Value) Then 'if it's been taged
            SelectFile.Next_Unit                           'open it
            If (first) Then                                'and print
                Application.Dialogs(xlDialogPrint).Show
                first = False
            Else
                ActiveWindow.SelectedSheets.PrintOut
            End If
        Else: Range("Current_Aging_File").Value = Range("Current_Aging_File").Value + 1
            'else move to next file
        End If
    Next i
    Range("Current_Aging_File").Value = StartingPos - 1 'move back to Starting unit
    SelectFile.Next_Unit
End Sub
 



Hi,

"...the graphs shrinks..."

Could you describe what that means?

"...it's now much smaller than the other..."

Maybe a word picture. I'm sure not getting it.

Please be Clear, Concise and Complete.

Skip,

[glasses] To be safe on the [red]FOURTH[/red],
Don't take a [red]FIFTH[/red] on the [red]THIRD[/red]
Or you might not come [red]FORTH[/red] on the [red]FIFTH[/red]
[red][highlight blue]FORTH[/highlight][/red][white][highlight red]WITH[/highlight][/white] [tongue]
 
Well at some point it started to mess with the other graph and now they're both shrinking. Before the macro starts they look like this:
beforefe5.jpg

and after they look like this:
afterfu7.jpg

Just printing does not change them in any way and running all subs called in the posted one does not change the graph sizes (at least not by themselves) and when I step through the process the graphs remain the same size
 



Just thinking out loud here.....

There are several objects that have TOP, LEFT, WIDTH, HEIGHT properties.

The

ChartObject object

ChartArea object

PlotArea object (also has INSIDE... properities)

Also, check the ChartArea Format Object - FONT tab and UNCHECK AutoScale as this has a way of screwing up formatting as the number of data elements and scale changes.

Other than that, I have no suggestions without any new information.

Skip,

[glasses] To be safe on the [red]FOURTH[/red],
Don't take a [red]FIFTH[/red] on the [red]THIRD[/red]
Or you might not come [red]FORTH[/red] on the [red]FIFTH[/red]
[red][highlight blue]FORTH[/highlight][/red][white][highlight red]WITH[/highlight][/white] [tongue]
 
Thanks for giving me a place to start. The PlotArea was changing so I added this macro and call it before the prints:
Code:
Public Sub restorePlots()
    For i = 1 To Sheets("Drift").ChartObjects.Count
        With Sheets("Drift").ChartObjects(i).Chart
        .Axes(xlCategory).AxisTitle.AutoScaleFont = False
            With .PlotArea
                .Left = 40
                .Top = 0
                .Height = 190
                .Width = 440
            End With
            With .Axes(xlCategory).AxisTitle
                With .Font
                    .Name = "Arial"
                    .FontStyle = "Bold"
                    .Size = 12
                    .Shadow = False
                End With
            End With
            With .Axes(xlValue).AxisTitle
                With .Font
                    .Name = "Arial"
                    .FontStyle = "Bold"
                    .Size = 12
                    .Shadow = False
                End With
            End With
        End With
    Next i
End Sub
Could probably be done better but I'm just happy to have it working
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top