Set objWord = CreateObject("Word.Application") Note that this requires adding a reference to Microsoft Word 15.0 Object Library Sub Generate() I had some trouble adding bullets, so here is the code that worked for me. Paragraphs(2). ListTemplate:= _Įxample from Excel VBA for creating numbered list in Word ListGalleries(wdNumberGallery).ListTemplates(1), ContinuePreviousList:= _įalse, ApplyTo:=wdListApplyToWholeList, DefaultListBehavior:= _ ' why does this have to be done after creating text? ![]() ' Yields execution so that the operating system can process other events. Set oWordApp = CreateObject("Word.Application") Set oWordApp = GetObject(, "Word.Application") '~~> Establish an Word application object Can this be done in a single pass like VBA allows us to do with bold or italics?ĭim oWordApp As Object, oWordDoc As Object In order to do certain formatting (bullets, numbering, putting text in tables etc.) it appears necessary to make a second pass and apply formatting after text is created. ![]() In the example below, I write a Word paragraph 6 times. I have been playing with VBA code that permits automatic creation of word documents.
0 Comments
Leave a Reply. |