Share via

Help with Run-time error '438': Object doesn't support this property or method

Anonymous
2012-03-02T00:30:42+00:00

The following macro works great with Excel 2010 (Windows 7) but when running on 2003 (XP OS) I receive a run-time error '438': Object doesn't support this property or method. The error shows up on bolded line .ThemeColor = xlThemeColorDark1.

Any help you be greatly appreciated. Thanks Tom.

Sub PrintDoorProjectSummary()

    Application.ScreenUpdating = False

    Sheets("Door Project Summary").Select

    Range("B7:H7,B13:H13,B21:H21").Select

    Range("B21").Activate

    Range("B7:H7,B13:H13,B21:H21,B40:H40,B53:H53").Select

    Range("B53").Activate

    Range("B7:H7,B13:H13,B21:H21,B40:H40,B53:H53,B69:H69,B75:H75").Select

    Range("B75").Activate

    With Selection.Interior

        .Pattern = xlSolid

        .PatternColorIndex = xlAutomatic

        .ThemeColor = xlThemeColorDark1

        .TintAndShade = 0

        .PatternTintAndShade = 0

    End With

    With Selection.Font

        .ThemeColor = xlThemeColorLight1

        .TintAndShade = 0

    End With

    Range("G9:H11").Select

    With Selection.Interior

        .Pattern = xlSolid

        .PatternColorIndex = xlAutomatic

        .ThemeColor = xlThemeColorDark1

        .TintAndShade = 0

        .PatternTintAndShade = 0

    End With

    With Selection.Font

        .ThemeColor = xlThemeColorLight1

        .TintAndShade = 0

    End With

    Range("D9:F11,B11:C11,H22").Select

    Range("H22").Activate

    Range("D9:F11,B11:C11,H22,F57,B58:F65").Select

    Range("D61").Activate

    With Selection.Interior

        .Pattern = xlSolid

        .PatternColorIndex = xlAutomatic

        .ThemeColor = xlThemeColorDark1

        .TintAndShade = 0

        .PatternTintAndShade = 0

    End With

    Range("D66,H66").Select

    Range("H66").Activate

    With Selection.Interior

        .Pattern = xlSolid

        .PatternColorIndex = xlAutomatic

        .ThemeColor = xlThemeColorDark1

        .TintAndShade = 0

        .PatternTintAndShade = 0

    End With

    With Selection.Font

        .ThemeColor = xlThemeColorLight1

        .TintAndShade = 0

    End With

    Range("B14:H14,B22:G22").Select

    Range("B22").Activate

    Range("B14:H14,B22:G22,B41:H41").Select

    Range("B41").Activate

    Range("B14:H14,B22:G22,B41:H41,B54:H55").Select

    Range("B54").Activate

    Range("B14:H14,B22:G22,B41:H41,B54:H55,B76:H76").Select

    Range("B76").Activate

    With Selection.Interior

        .Pattern = xlSolid

        .PatternColorIndex = xlAutomatic

        .ThemeColor = xlThemeColorDark1

        .TintAndShade = 0

        .PatternTintAndShade = 0

    End With

    ActiveWindow.SelectedSheets.PrintPreview

    Range("B7:H7,B13:H13,B21:H21").Select

    Range("B21").Activate

    Range("B7:H7,B13:H13,B21:H21,B40:H40,B53:H53").Select

    Range("B53").Activate

    Range("B7:H7,B13:H13,B21:H21,B40:H40,B53:H53,B69:H69,B75:H75").Select

    Range("B75").Activate

    With Selection.Interior

        .Pattern = xlSolid

        .PatternColorIndex = xlAutomatic

        .Color = 8421376

        .TintAndShade = 0

        .PatternTintAndShade = 0

    End With

    With Selection.Font

        .ThemeColor = xlThemeColorDark1

        .TintAndShade = 0

    End With

    Range("B14:H14,B22:G22").Select

    Range("B22").Activate

    Range("B14:H14,B22:G22,B41:H41").Select

    Range("B41").Activate

    Range("B14:H14,B22:G22,B41:H41,B54:H55").Select

    Range("B54").Activate

    Range("B14:H14,B22:G22,B41:H41,B54:H55,B76:H76").Select

    Range("B76").Activate

    With Selection.Interior

        .Pattern = xlSolid

        .PatternColorIndex = xlAutomatic

        .Color = 14540253

        .TintAndShade = 0

        .PatternTintAndShade = 0

    End With

    Range("D66,H66").Select

    Range("H66").Activate

    With Selection.Interior

        .Pattern = xlSolid

        .PatternColorIndex = xlAutomatic

        .Color = 13395456

        .TintAndShade = 0

        .PatternTintAndShade = 0

    End With

    With Selection.Font

        .ThemeColor = xlThemeColorDark1

        .TintAndShade = 0

    End With

    Range("G9:H11").Select

    With Selection.Interior

        .Pattern = xlSolid

        .PatternColorIndex = xlAutomatic

        .Color = 128

        .TintAndShade = 0

        .PatternTintAndShade = 0

    End With

    With Selection.Font

        .ThemeColor = xlThemeColorDark1

        .TintAndShade = 0

    End With

    Range("D9:F11,B11:C11,H22").Select

    Range("H22").Activate

    Range("D9:F11,B11:C11,H22,F57,B58:F65").Select

    Range("F60").Activate

    With Selection.Interior

        .Pattern = xlSolid

        .PatternColorIndex = xlAutomatic

        .Color = 13434879

        .TintAndShade = 0

        .PatternTintAndShade = 0

    End With

    Range("G40:H40").Select

    With Selection.Interior

        .Pattern = xlSolid

        .PatternColorIndex = xlAutomatic

        .Color = 128

        .TintAndShade = 0

        .PatternTintAndShade = 0

    End With

    With Selection.Font

        .ThemeColor = xlThemeColorDark1

        .TintAndShade = 0

    End With

    ActiveWindow.SmallScroll Down:=-51

    Range("B2").Select

End Sub

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2012-03-02T11:58:14+00:00

Properties such as ThemeColor, TintAndShade, PatternTintAndShade were introduced in Excel 2007. They are unknown in Excel 2003 and earlier. You'll have to remove all lines that use one of the above.

For text, you'll have to use code like

Selection.Font.Color = vbRed

or

Selection.Font.ColorIndex = 3

And for the fill color:

Selection.Interior.Color = vbYellow

or

Selection.Interior.ColorIndex = 6

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful