回答編集履歴
1
追記
test
CHANGED
@@ -35,3 +35,65 @@
|
|
35
35
|
Next
|
36
36
|
|
37
37
|
```
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
**追記**
|
42
|
+
|
43
|
+
確かに結合セルがあるとエラーになります。
|
44
|
+
|
45
|
+
結合セルを考慮して修正するとこのようになりましたが、
|
46
|
+
|
47
|
+
まだ問題があるようでしたらコメントをお願いします。
|
48
|
+
|
49
|
+
```VBA
|
50
|
+
|
51
|
+
Sub Sample()
|
52
|
+
|
53
|
+
Dim tbl As Table
|
54
|
+
|
55
|
+
Dim row As row
|
56
|
+
|
57
|
+
Dim cell As cell
|
58
|
+
|
59
|
+
For Each tbl In ActiveDocument.Tables
|
60
|
+
|
61
|
+
Dim rowNum As Long: rowNum = 1
|
62
|
+
|
63
|
+
Do While rowNum <= tbl.Rows.Count
|
64
|
+
|
65
|
+
tbl.cell(rowNum, 1).Select
|
66
|
+
|
67
|
+
With Selection
|
68
|
+
|
69
|
+
.SelectRow
|
70
|
+
|
71
|
+
For Each cell In .Cells
|
72
|
+
|
73
|
+
If cell.Shading.BackgroundPatternColor = RGB(79, 129, 189) Then
|
74
|
+
|
75
|
+
With cell.Range
|
76
|
+
|
77
|
+
.Font.Name = "MS Pゴシック"
|
78
|
+
|
79
|
+
.Font.Bold = True
|
80
|
+
|
81
|
+
.ParagraphFormat.Alignment = wdAlignParagraphCenter
|
82
|
+
|
83
|
+
End With
|
84
|
+
|
85
|
+
End If
|
86
|
+
|
87
|
+
Next
|
88
|
+
|
89
|
+
rowNum = .Information(wdEndOfRangeRowNumber) + 1
|
90
|
+
|
91
|
+
End With
|
92
|
+
|
93
|
+
Loop
|
94
|
+
|
95
|
+
Next
|
96
|
+
|
97
|
+
End Sub
|
98
|
+
|
99
|
+
```
|