excel - Reset Numbered List with Text Style VBA macro MS Word -


I'm trying to create a VBA macro to create Word documents from Excel ... I currently have problems listing Setting up correctly I need the list serial number listed with 2 headers types. This is the same:

  1 top 1.1 Header 2 2. Header 1 2.1 Header 2   

The problem is that my level 2 list is not being reset, although I have included it .ResetOnHigher property means that I do this Finding results that looks like this:

  1 top 1.1 Header2 2. Header1.2 Header2   

Can anyone tell me what I am doing and what can I do to resolve this issue?

Here's a part of the code I'm using:

  (...) with ListGalleries (wdOutlineNumberGallery) .ListTemplates (1) .ListLevels (1 ) .NumberFormat = "% 1." .terringcutor = wdTrailingTab .NumberStyle = wdListNumberStyleArabic.NumberPosition = CentimetersToPoints (0) .Element = wdListLevelAlignLeft .extPosition = CentimetersToPoints (0.63). Tabpoint = wdUndefined .STATAUT = 1 With End Date Galleries (wdOutlineNumberGallery) .list template (1). List Level (2) .NumberFormat = "% 1% 2." .tracking = character = wdTrailingTab .NumberStyle = wdListNumberStyleArabic.NumberPosition = CentimetersToPoints (0.63) .Element = wdListLevelAlignLeft .extPosition = CentimetersToPoints (1.4). TABPosition = wdUndefined .ResetOnHigher = 1. With MyDoc '1 interval with StartAt = 1 interval. Style (wdStyleHeading1) .font.Name = "Arial" .Styles (wdStyleHeading1) .Font. Size = 24 .Styles (wdStyleHeading1) .Folt. Color = wdColorBlack .Styles (wdStyleHeading1) .Font. Bold = true .Styles (wdStyleHeading1). Paragraph formatting Liningsing Rule = WdLineSpaceSingle .Styles (wdStyleHeading1). Paragrafformetkspesaftr = 12 .Styles (wdStyleHeading1) .LinkToListTemplate _ ListTemplate: = ListGalleries (wdOutlineNumberGallery) .ListTemplates (1), _ListLevelNumber: = 1 'Title 2 .Styles (wdStyleHeading2) Kfont. Name = "aerial" .Styles (wdStyleHeading2) .Font.Size = 18 .Styles (wdStyleHeading2) .Folt. Color = wdColorBlack .Styles (wdStyleHeading2) .Font. Bold = true .Styles (wdStyleHeading2). Paragraph format.line spacing royal = wdLineSpaceSingle s tiles (wdStyleHeading2). Paragraph formatt.aspaceifier = 12 Stylus (wdStyleHeading2) Klinkolist template _ Suchitemplet = Suchigalri (wdOutlineNumberGallery) .ListTemplates (1), _ListLevelNumber: = 2 (with end ...) Check WS_Count - L '= 2 to loop I through the sheets that Is the sheet to be included and if its content is past in this word then this wordbook. Worksheet (I). Curse ("Enable"). OLEFormat.Object.Value = 1 = True then 'Insert group title if the group is different, then this workbook. Worksheets (I). Game (1, 1). Value = this workbook Worksheets (I - 1) .Cell (1, 1). Value = wrong then my dock. Paragraph last. category. Style = MyDoc.Styles ("Heading 1") myDoc.Paragraphs.Last.Range.Text = ThisWorkbook.Worksheets (I). Range ("A1") myDoc.Paragraphs.Last.Range.InsertParagraphAfter End 'page title myDoc Insert Article. Final category. Style = myDoc.Styles ("Heading 2") myDoc.Paragraphs.Last.Range.Text = ThisWorkbook.Worksheets (I). Insert Range ( "A-2") myDoc.Paragraphs.Last.Range.InsertParagraphAfter 'Call table ExcelRangeToWord to (MyDo C, this workbook. Worksheets (I) Krenjh ( "Series 1"), 1) myDoc.Paragraphs. Call Last.Range.InsertParagraph ExcelRangeToWord to (myDoc, ThisWorkbook.Worksheets (I). range ( "range2"), 2) myDoc Paragrafklistkrenjkinsserrt paragraph "page insert paragraph I paragraph I paragraph. Last .range.instreck (wdPageBreak) end if (...)    

OK I had the same problem and took me all day to solve it. The thing is that you are styling and within each style you are pointing to list + listlevel. When you are using these styles, each style is making an inventory of itself, then this solution is to be done in another way.

You have to create a new list template with all the list list and within each list level, you must tell the styles:

ActiveDocument.ListTemplates ("LT"). ListLevels (1) .LinkedStyle = "Style1"

And when you want to use this specific format, then enter it like this:

Range.list format. Epilestem Temple with Libell ListTemplate: = Active DocumentList.List Templates ("LT"), ContinueEntire List: = True, Apply: = 1

Enjoy =)

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -