![]() |
#1
|
|||
|
|||
![]()
Good morning all,
I allow myself to ask your help for a problem which, despite my research on the internet, does not find answers. I am introducing you my problem. I export from Excel a succession of paragraphs to a single bookmark of an openned Word document. These different paragraphs are structured as follows (illustrative text): A. Getting started (1). Please turn on your PC (2). Please wait for full boot (a). Option 1: ... (b). Option 2: ... B. Parameterization (1). etc ... (2). etc ... (3). etc .... Then, I wanted to know if it was possible to assign to each paragraph (A. ...; (1). ...; (a). ...) a heading style that I had already configured in my Word document (heading style without numbering because they are already present during export). I had started writing this piece of code: Code:
Dim Paragraph As Word.Paragraph Selection.GoTo What:=wdGoToBookmar, name:="Z1" With Selection For each Paragraph in Selection.Paragraphs Paragraphe.Style = ActiveDocument.Styles("ZStyle(1)") Next End with - If the paragraph begins with "A." or "B." etc ...; assign it heading style 1 - If the paragraph begins with "(1)." or "(2)." etc ...; assign it heading style 2 - If the paragraph begins with "(a)." or "(b)." etc ...; assign it heading style 3 In addition, there are may be empty lines between two paragraphs (I mean end of paragraph marks) which of course I do not want to assign a heading style. I hope I managed to be understandable. Do not hesitate to tell me if more precision is needed. I thank in advance all people who can help me. Have a good day |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Formatting all paragraphs based on pre defined styles | afif | Word VBA | 0 | 07-26-2019 06:18 AM |
Add a heading for each paragraph depending on the previous paragraphs numbering | herman | Word | 4 | 07-15-2019 09:48 PM |
![]() |
Volle13 | Word | 8 | 12-05-2016 06:14 PM |
![]() |
Hallet | Word | 1 | 05-31-2012 02:37 PM |
![]() |
Jamal NUMAN | Word | 3 | 07-24-2011 04:33 PM |