View Single Post
 
Old 08-18-2023, 08:44 PM
darkmaster006 darkmaster006 is offline Windows 10 Office 2021
Novice
 
Join Date: Aug 2023
Posts: 10
darkmaster006 is on a distinguished road
Default

Quote:
Originally Posted by Italophile View Post
Without seeing the document, it is only possible to guess.
Oh, alright! I've uploaded an example file with the text that I talked about, if that helps.

Quote:
Originally Posted by vivka View Post
Hi again! Unfortunaltely, from the very beginning it was not clear that the document had a page filling color. After the misunderstanding has been corrected, here's the code that seems to work:

Code:
Sub Deshading()

Dim oPara As Paragraph
'If the selection includes tables, error 4605 will be returned.
'Thus, an error handler is needed:
On Error Resume Next

Application.ScreenUpdating = False
    For Each oPara In ActiveDocument.range.Paragraphs
        oPara.range.Select
        If Not selection.Shading.BackgroundPatternColor = wdColorAutomatic Then
            selection.Shading.BackgroundPatternColor = wdColorAutomatic
        End If
    Next oPara
Application.ScreenUpdating = True
End Sub
Thank you for the help! This does not seems to work, sadly. Furthermore, it seems to select the last paragraph and make the cursor go to the end of the document.
Attached Files
File Type: docx example.docx (12.9 KB, 5 views)
Reply With Quote