Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
|
Lista Forumurilor Pe Tematici
|
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login
POZE MRRRR'S FORUM (VIEW ONLY)
Nu sunteti logat.
|
Nou pe simpatie: Crina.candy
| Femeie 23 ani Harghita cauta Barbat 24 - 44 ani |
|
TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 787
|
|
The following code deletes entire paragraphs in the active document that have the RGB: 184,221,241 color shading. You can replace the values in RGB with your own.
Just open VBA from Word, make new module and paste the following:
Sub DeleteParagraphIfShading() Application.ScreenUpdating = False
Dim para As Paragraph For Each para In ActiveDocument.Paragraphs On Error Resume Next
If para.Range.Shading.BackgroundPatternColor = RGB(184, 221, 241) Then para.Range.Delete End If Next
Application.ScreenUpdating = True End Sub |
Modificat de TRaP (acum 6 ani)
|
|
pus acum 6 ani |
|
TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 787
|
|
If you want, for example to shrink the text of a paragraph, you insert the following snippet inside the For function above:
If para.Range.Shading.BackgroundPatternColor = RGB(255, 250, 250) Then para.Range.Font.Size = 5 End If |
|
|
pus acum 6 ani |
|
TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 787
|
|
Made a user form with 2 buttons, one called Dark Blue and another one called Lite Blue.
Command button 1 and 2 click takes you to:
Private Sub CommandButton1_Click() Application.ScreenUpdating = False
Dim para As Paragraph
For Each para In ActiveDocument.Paragraphs On Error Resume Next If para.Range.Shading.BackgroundPatternColor = RGB(184, 221, 241) Then para.Range.Delete End If Next
Application.ScreenUpdating = True End Sub
Private Sub CommandButton2_Click() Application.ScreenUpdating = False
Dim para As Paragraph
For Each para In ActiveDocument.Paragraphs On Error Resume Next If para.Range.Shading.BackgroundPatternColor = RGB(230, 249, 255) Then para.Range.Delete End If Next
Application.ScreenUpdating = True End Sub
|
Calling User Form with macro:
Sub ParagDeleteForm() ParagraphDeleteForm.Show End Sub |
Modificat de TRaP (acum 6 ani)
|
|
pus acum 6 ani |
|