PDA

View Full Version : Word Macro to Select the First Image in DOCX & set its "Style" to Normal



steve8445
03-01-2016, 11:08 AM
Can anyone help with a Word VBA Macro to:



Select the First Image in my DOCX & set it's "Style" to Normal ?

Thanks.

gmaxey
03-03-2016, 02:28 PM
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oPar As Paragraph
On Error Resume Next
'Either
ActiveDocument.Shapes(1).Anchor.Style = "Normal"
'or
ActiveDocument.InlineShapes(1).Range.Style = "Normal"
'or
For Each oPar In ActiveDocument.Paragraphs
If ActiveDocument.InlineShapes(1).Range.InRange(oPar.Range) Then
oPar.Range.Font.Reset
oPar.Range.Style = "Normal"
Exit For
End If
Next
lbl_Exit:
Exit Sub

End Sub

steve8445
03-03-2016, 03:41 PM
Many thanks for your help.