Sub Main
'Declares GrapherApp as an Object
Dim GrapherApp As Object

'Start Grapher
Set GrapherApp = CreateObject("Grapher.Application")

'Make the Grapher window visible
GrapherApp.Visible = True

'Open the bar chart orientations.grf sample file
Set Plot1 = GrapherApp.Documents.Open(GrapherApp.Path+"\Samples\bar chart orientations.gpj")

'Loop through and find only graphs
For i = 1 To Plot1.Shapes.Count
	If Plot1.Shapes.Item(i).Type = grfShapeGraph Then
    	'Once you find a graph, loop through and find only axes
        For j = 1 To Plot1.Shapes.Item(i).Axes.Count
        	'Once you find an axis, see if it is an X Axis
            If Plot1.Shapes.Item(i).Axes.Item(j).axisType = grfXAxis Then
            	'If it is an X Axis, change the min and max values - these can be values that are previously set to a variable
                Plot1.Shapes.Item(i).Axes.Item(j).AutoMin = False
                Plot1.Shapes.Item(i).Axes.Item(j).AutoMax = False
                Plot1.Shapes.Item(i).Axes.Item(j).Min = 3
                Plot1.Shapes.Item(i).Axes.Item(j).Max = 28
                'Change the label format
                Plot1.Shapes.Item(i).Axes.Item(j).TickLabels.MajorFormat.DateTimeFormat = 5
			End If
		'Find the next axis
        Next j
	End If
'Find the next graph
Next i

End Sub
