回答編集履歴
3
Word用追加
test
CHANGED
@@ -19,3 +19,35 @@
|
|
19
19
|
End With
|
20
20
|
|
21
21
|
```
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
Word用
|
26
|
+
|
27
|
+
```VBA
|
28
|
+
|
29
|
+
For Each sh In Sections(1).Headers(wdHeaderFooterFirstPage).Shapes
|
30
|
+
|
31
|
+
sh.TextFrame.MarginLeft = 0
|
32
|
+
|
33
|
+
sh.TextFrame.MarginTop = 0
|
34
|
+
|
35
|
+
sh.TextFrame.MarginRight = 0
|
36
|
+
|
37
|
+
sh.TextFrame.MarginBottom = 0
|
38
|
+
|
39
|
+
l = Len(sh.TextFrame.TextRange.Text) - 1
|
40
|
+
|
41
|
+
w = sh.Width
|
42
|
+
|
43
|
+
h = sh.Height
|
44
|
+
|
45
|
+
s = w / l
|
46
|
+
|
47
|
+
If s > h Then s = h
|
48
|
+
|
49
|
+
sh.TextFrame.TextRange.Font.Size = s
|
50
|
+
|
51
|
+
Next
|
52
|
+
|
53
|
+
```
|
2
縦方向も考慮したコードに修正
test
CHANGED
@@ -8,7 +8,13 @@
|
|
8
8
|
|
9
9
|
w = .Width - .TextFrame.MarginLeft - .TextFrame.MarginRight
|
10
10
|
|
11
|
+
h = .Height - .TextFrame.MarginTop - .TextFrame.MarginBottom
|
12
|
+
|
13
|
+
s = w / l
|
14
|
+
|
15
|
+
If s > h Then s = h
|
16
|
+
|
11
|
-
.TextEffect.FontSize =
|
17
|
+
.TextEffect.FontSize = s
|
12
18
|
|
13
19
|
End With
|
14
20
|
|
1
無駄なコードを修正
test
CHANGED
@@ -8,10 +8,8 @@
|
|
8
8
|
|
9
9
|
w = .Width - .TextFrame.MarginLeft - .TextFrame.MarginRight
|
10
10
|
|
11
|
-
|
11
|
+
.TextEffect.FontSize = w / l
|
12
12
|
|
13
13
|
End With
|
14
14
|
|
15
|
-
|
16
|
-
|
17
15
|
```
|