R
rosano.silveira
I'm kinda a newbie to Word VBA. I generated a macro for removing
right, top, bottom borders of a cell frm a table. But when i try to
run the macro after modifying the code to run for multiple cells. I
gives an error msg
Run-Time Error 5843: One of the values passed to this method or
property is out of range.
With Selection.Cells
With .Borders(wdBorderLeft)
.LineStyle = wdLineStyleOutset
.LineWidth = wdLineWidth075pt ---> Errors out on this line
.Color = wdColorAutomatic
End With
.Borders(wdBorderRight).LineStyle = wdLineStyleNone
.Borders(wdBorderTop).LineStyle = wdLineStyleNone
.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
.Borders.Shadow = False
End With
With Options
.DefaultBorderLineStyle = wdLineStyleOutset
.DefaultBorderLineWidth = wdLineWidth075pt
.DefaultBorderColor = wdColorAutomatic
End With
Any advice on this would help. Thanks.
right, top, bottom borders of a cell frm a table. But when i try to
run the macro after modifying the code to run for multiple cells. I
gives an error msg
Run-Time Error 5843: One of the values passed to this method or
property is out of range.
With Selection.Cells
With .Borders(wdBorderLeft)
.LineStyle = wdLineStyleOutset
.LineWidth = wdLineWidth075pt ---> Errors out on this line
.Color = wdColorAutomatic
End With
.Borders(wdBorderRight).LineStyle = wdLineStyleNone
.Borders(wdBorderTop).LineStyle = wdLineStyleNone
.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
.Borders.Shadow = False
End With
With Options
.DefaultBorderLineStyle = wdLineStyleOutset
.DefaultBorderLineWidth = wdLineWidth075pt
.DefaultBorderColor = wdColorAutomatic
End With
Any advice on this would help. Thanks.