David.P
10-18-2014, 11:24 AM
Hi forum,
I am trying to make a Word VBA macro to only jump in and act if the currently selected text in the Word document (or the text where the cursor currently is placed, respectively) has a certain list style, namely the list style "Bullet" (wdListBullet).
I gather that the code should be something along these lines:
Sub Act_On_Bulleted_Text()
With Selection.Style
If .ListFormat.ListType = WdListType.wdListBullet
Then
[Do something]
Else
[Do something else]
End If
End With
End Sub
However, the query in the second and third lines above probably is not quite right yet.
Thanks already for reading, and for any hints in order to make the above code work,
Regards
David
I am trying to make a Word VBA macro to only jump in and act if the currently selected text in the Word document (or the text where the cursor currently is placed, respectively) has a certain list style, namely the list style "Bullet" (wdListBullet).
I gather that the code should be something along these lines:
Sub Act_On_Bulleted_Text()
With Selection.Style
If .ListFormat.ListType = WdListType.wdListBullet
Then
[Do something]
Else
[Do something else]
End If
End With
End Sub
However, the query in the second and third lines above probably is not quite right yet.
Thanks already for reading, and for any hints in order to make the above code work,
Regards
David