Microsoft KB Archive/111972

{|
 * width="100%"|

XL5: Can't Get or Set Properties of X Axis in XY Scatter Chart

 * }

-

The information in this article applies to:


 * Microsoft Excel for Windows, version 5.0

-

SYMPTOMS
In Microsoft Excel version 5.0, you may receive one of the following error messages when you attempt to set or return the x axis scale properties for an xy (scatter) chart:

Run-time error '1005':

"Unable to set the property of the axis class"

"-or-"

Run-time error '1005':

"Unable to get the property of the axis class"

CAUSE
The following Visual Basic axis class properties for the x axis of an xy (scatter) chart may cause the above error messages:

.Axes(xlCategory).MinorUnit

.Axes(xlCategory).MajorUnit

.Axes(xlCategory).MinimumScale

.Axes(xlCategory).MaximumScale

.Axes(xlCategory).MinimumScaleIsAuto

.Axes(xlCategory).MaximumScaleIsAuto

.Axes(xlCategory).MinorUnitIsAuto

.Axes(xlCategory).MajorUnitIsAuto

.Axes(xlCategory).ScaleType

WORKAROUND
To set any of the above properties when the axis in question is the x axis in an (xy) scatter chart, use the Application.ExecuteExcel4Macro method with the Microsoft Excel 4.0 SCALE macro command. Below is the syntax of the Visual Basic command:

  ' Enter the following line of code as a single, continuous line: Application.ExecuteExcel4Macro _ ("SCALE(min_num,max_num,major,minor,cross,logarithmic,reverse,max)") The following values are acceptable for the arguments for this method

  Argument      value     equivalent to   ---

min_num      TRUE      MinimumScaleIsAuto = True MinimumScale =

max_num      TRUE      MaximumScaleIsAuto = True MaximumScale =

major        TRUE      MajorUnitIsAuto = True MajorUnit =

minor        TRUE      MinorUnitIsAuto = True MinorUnit =

cross        TRUE      Crosses = xlAutomatic (if max = FALSE) Crosses = xlCustom, CrossesAt = (if max = FALSE)

logarithmic  TRUE      ScaleType = xlLogarithmic FALSE    ScaleType = xlLinear

reverse      TRUE      ReversePlotOrder = True FALSE    ReversePlotOrder = False

max          TRUE      Crosses = xlMaximum FALSE    see "cross", above For example, to set the minimum scale of the X axis to 5, the maximum scale to 20, and reverse the plot order of the axis, you would use this command:

' This line selects the axis. ActiveSheet.Axes(xlCategory).Select ' This line makes the changes. Application.ExecuteExcel4Macro ("scale(5,20,,,,,true)") Note that the above macro will work only if the chart is created as a separate chart sheet (that is, it will not work with a chart embedded on a worksheet).

STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Excel for Windows version 5.0c.