VBA Word Paragraph Text Effects Properties

rhivert

New Member
Joined
Dec 9, 2010
Messages
12
Hi,

I am trying to pull (from an Excel 2019 workbook) the text effects (outline, shadow, reflection, glow) applied to different paragraphs (or 1st word in each paragraph) of a Word 2019 document.

When I run the code, although the Word document has text effects applied to each paragraph I get a "0" for outline and no values being returned for the other effects.

Please help! I have copied the code below.

Thanks in advance!

VBA Code below:

Sub MSWordProp()

Dim oWordApp As Word.Application
Dim WordNotOpen As Boolean
Dim oDoc As Word.Document
Dim oRange As Word.Range
Dim p As Integer 'paragraph variable

On Error Resume Next 'If there is an error ignore and go to next item

Application.Volatile 'Forces recalculation

Set oWordApp = CreateObject("Word.Application")

If Err Then
Set oWordApp = New Word.Application
WordNotOpen = True
End If

oWordApp.Visible = True
oWordApp.Activate

Set oDoc = oWordApp.Documents.Open("C:\Users\randa\Downloads\UA1_Examen Telecharger oct. 6 2020 19 h 55\UA1_Examen_RN.docx")

'On Error GoTo 0 'Check for error 13

ActiveWorkbook.Worksheets("LC_24489").Range("B2:BK76").Select.ClearContents

For p = 1 To 65

Set oRange = oDoc.Paragraphs(p).Range

'ActiveWorkbook.Worksheets("LC_24489").Cells(p, 60).Offset(1, 0) = Selection.Font.Outline
'ActiveWorkbook.Worksheets("LC_24489").Cells(p, 61).Offset(1, 0) = Selection.Font.TextShadow
'ActiveWorkbook.Worksheets("LC_24489").Cells(p, 62).Offset(1, 0) = Selection.Font.Reflection
'ActiveWorkbook.Worksheets("LC_24489").Cells(p, 63).Offset(1, 0) = Selection.Font.Glow

Next p

End Sub
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,214,822
Messages
6,121,765
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top