Runtime Error 5843

  • Thread starter rosano.silveira
  • Start date
R

rosano.silveira

I'm 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.
 
G

Greg Maxey

And this is a good place to post your question and stop. I answered a
simliar question by another user in VBA General. Any relation?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top