teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

追記

2021/10/29 15:08

投稿

jinoji
jinoji

スコア4592

answer CHANGED
@@ -54,4 +54,35 @@
54
54
  Next
55
55
 
56
56
  End Sub
57
+ ```
58
+ ---
59
+ <追記>
60
+ Excelから呼び出すのも同じ感じで行けると思います。
61
+ ただ、以下はPowerPointが既に起動している前提で書いているので、
62
+ そうでない場合はもう一工夫いるのかもしれません。
63
+
64
+ ```VBA
65
+ Sub ExcelVBASample()
66
+
67
+ Dim ppap As PowerPoint.Application
68
+ Set ppap = GetObject(, "Powerpoint.Application")
69
+
70
+ Dim shp As PowerPoint.Shape
71
+ Set shp = ppap.ActivePresentation.Slides(1).Shapes(1)
72
+
73
+ Dim tbl As PowerPoint.Table
74
+ Set tbl = shp.Table
75
+
76
+ Dim coll As Collection
77
+ Set coll = TableCells(tbl)
78
+
79
+ Debug.Print coll.Count
80
+
81
+ Dim c As Cell
82
+ For Each c In coll
83
+ Debug.Print c.Shape.TextFrame2.TextRange.Text
84
+ Next
85
+
86
+ End Sub
87
+
57
88
  ```

1

修正

2021/10/29 15:08

投稿

jinoji
jinoji

スコア4592

answer CHANGED
@@ -7,7 +7,7 @@
7
7
  Dim dic 'As New Scripting.Dictionary
8
8
  Set dic = CreateObject("Scripting.Dictionary")
9
9
 
10
- dic("1 1") = 0
10
+ Set dic("1 1") = tbl.Rows(1).Cells(1)
11
11
 
12
12
  Dim i, j, c
13
13
  For i = 1 To tbl.Rows.Count