![]() |
|
#1
|
|||
|
|||
|
Code:
Sub test()
Dim wrdApp As Word.Application
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Dim wrdDoc As Word.Document
Set wrdDoc = wrdApp.Documents.Add
Dim wrdTbl As Word.Table
Set wrdTbl = wrdDoc.Tables.Add(Range:=wrdDoc.Range, NumRows:=6, NumColumns:=1)
With wrdTbl
.Borders(wdBorderTop).LineStyle = wdLineStyleSingle
.Borders(wdBorderLeft).LineStyle = wdLineStyleSingle
.Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
.Borders(wdBorderRight).LineStyle = wdLineStyleSingle
.Borders(wdBorderHorizontal).LineStyle = wdLineStyleSingle
.Borders(wdBorderVertical).LineStyle = wdLineStyleSingle
For r = 1 To 6
.Cell(r, 1).Range.Text = ActiveSheet.Cells(r, 1).Value
Next r
End With
' Dim temp3 As ListGalleries
For r = 1 To 6 Step 2
Set temp3 = wrdApp.ListGalleries(wdNumberGallery).ListTemplates(1).ListLevels(1)
With temp3
.NumberFormat = "%1."
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = CentimetersToPoints(0.63)
.Alignment = wdListLevelAlignLeft
.TextPosition = CentimetersToPoints(1.27)
.TabPosition = wdUndefined
.StartAt = r
End With
Dim rng As Range
Set rng = wrdDoc.Range(Start:=wrdDoc.Range.Rows(1).Range.Start, End:=wrdDoc.Range.Rows(6).Range.End)
rng.ListFormat.ApplyListTemplate ListTemplate:=temp3
Next r
End Sub
Don't know why so difficult to use ListGalleries in Excel to control Word... Have found millions of entries online but could hardly find one. Could anyone please help a bit? I'm desperate... Near nil online coverage on Word VBA... Last edited by tinfanide; 12-13-2011 at 04:44 AM. |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Excel VBA: Control Word Table and Set its properties | tinfanide | Excel Programming | 0 | 12-10-2011 09:06 AM |
is there file 'version' control in excel
|
keithg | Excel | 1 | 11-14-2010 07:51 AM |
| Control how Excel Opens | slew0302 | Office | 0 | 02-03-2009 01:30 PM |
| MS Word Field Tab Control? | mycon73 | Word | 0 | 09-24-2007 07:46 AM |
| Excel ->VB code for Checkbox (control toolbox) | kirkstyle | Excel | 0 | 08-16-2006 04:17 PM |