How to Extend Selection to whole paragraph via VBA

2019-09-15 19:26发布

问题:

I am using this code to extend selection to whole line on word document, Now I want to extend selection to whole paragraph

Selection.Expand wdLine

回答1:

Try using a different WdUnit like wdParagraph:

Selection.Expand wdParagraph

See this link for an overview of the different WdUnits: https://msdn.microsoft.com/en-us/library/office/ff838950.aspx



回答2:

If you know one of the enumerated values then you can use the Object Explorer to find the name of the Enumeration. By referencing the Enumeration you'll be able to use Intellisense to determine all the valid values.