Aloha... our office recently "upgraded" to Vista, including moving from MS Office 2003 to 2007. This code, which simply formats two ranges with various border and font settings, stopped working.
Specifically, when trying to set the border weights for the range "rngHoriz", they all give the '1004' error "Unable to set the Weight property of the Border class."
Things I've already determined...
The rngVert section works normally, no problems, with the same code.
It doesn't matter whether I run rngVert or rngHoriz first... rngHoriz always has the error.
The error occurs regardless of which border constant I use first (top, left, etc).
The rngHoriz is being created properly as far as I can tell, the formulas in the definition are correct and functioned normally until the upgrade to 2007.
Thanks in advance for any and all help. FYI, I am not a professional programmer, I just took enough programming and VB in particular during college to help with stuff like this around my office. So use small words.
Specifically, when trying to set the border weights for the range "rngHoriz", they all give the '1004' error "Unable to set the Weight property of the Border class."
Things I've already determined...
The rngVert section works normally, no problems, with the same code.
It doesn't matter whether I run rngVert or rngHoriz first... rngHoriz always has the error.
The error occurs regardless of which border constant I use first (top, left, etc).
The rngHoriz is being created properly as far as I can tell, the formulas in the definition are correct and functioned normally until the upgrade to 2007.
Code:
***********************************************************
'Add all appropriate borders and adjust font sizes
'*****************************************
Dim rngVert As Range 'the vertical portion of the chart
Dim rngHoriz As Range 'the horizontal axis of the chart
Set rngVert = Worksheets("Monthly").Range(Cells(intC130ACstart - 2, intFirstDay), Cells(intCOMMSend + 2, intLastDay))
Set rngHoriz = Worksheets("Monthly").Range(Cells(intC130ACstart, 1), Cells(intCOMMSend, intLastDay + 4))
'set font sizes
rngHoriz.Font.Size = 9
rngVert.Font.Size = 6.5
'set alignment
rngHoriz.HorizontalAlignment = xlLeft
rngVert.HorizontalAlignment = xlCenter
'set the small weight grid on all boxes
rngVert.Borders.LineStyle = xlContinuous
rngHoriz.Borders.LineStyle = xlContinuous
'put the med weight grid around the borders
With rngVert
.Borders(xlEdgeTop).Weight = xlMedium
.Borders(xlEdgeRight).Weight = xlMedium
.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlEdgeLeft).Weight = xlMedium
End With
With rngHoriz
.Borders(xlEdgeTop).Weight = xlMedium <------ERROR OCCURS HERE, BUT WILL OCCUR ON WHICHEVER EDGE IS LISTED FIRST
.Borders(xlEdgeRight).Weight = xlMedium
.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlEdgeLeft).Weight = xlMedium
End With
Thanks in advance for any and all help. FYI, I am not a professional programmer, I just took enough programming and VB in particular during college to help with stuff like this around my office. So use small words.