View Single Post
 
Old 09-12-2019, 05:30 PM
poetofpiano poetofpiano is offline Windows 10 Office 2016
Novice
 
Join Date: Sep 2015
Posts: 20
poetofpiano is on a distinguished road
Default Run Time Error 5843 When Applying Border

I have a macro that applies a border as follows:

Code:
With Selection
    With .Borders(wdBorderLeft)
        .LineStyle = wdLineStyleSingle 
        .LineWidth = Options.DefaultBorderLineWidth
        .Color = Options.DefaultBorderColor
    End With
    With .Borders(wdBorderRight)
        .LineStyle = wdLineStyleSingle
        .LineWidth = Options.DefaultBorderLineWidth
        .Color = Options.DefaultBorderColor
    End With
    With .Borders(wdBorderTop)
        .LineStyle = wdLineStyleSingle 
        .LineWidth = Options.DefaultBorderLineWidth
        .Color = Options.DefaultBorderColor
    End With
    With .Borders(wdBorderBottom)
        .LineStyle = wdLineStyleSingle 
        .LineWidth = Options.DefaultBorderLineWidth
        .Color = Options.DefaultBorderColor
    End With
End With
It works fine when I have selected about a page worth of text. However, when I select around two pages worth and run the code, I get "Run Time Error 5843: one of the values passed to this method or property is out of range." Can anyone offer any help? Thank you so much!
Reply With Quote