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
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