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

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Forum statistics

Threads
1,226,739
Messages
6,192,739
Members
453,754
Latest member
milestogo

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