0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

表の各行の高さをそろえる【PowerPointVBA】

Posted at

image.png

ppt上の表の各行の高さをそろえるメソッドがわからなかったので

  1. ループで総和求めて
  2. 平均出して
  3. ループで各行に高さ付与し直し

という手をとった
ググってズバリのメソッドを探すよりも作成コストが安くて動けば良いのでとりあえずこれで

高さをそろえるメソッドご存じの方いらっしゃったら教えてください・・・

Sub ppTable上の全行の高さをそろえる(TableObj As PowerPoint.Table, r_Top As Long)
'TableObj :pptスライド上のTableオブジェクト
'r_Top      :高さ修正対象の1行目 ヘッダ行が1行なら2
    
  Dim Rcnt
  Rcnt = TableObj.Rows.Count - r_Top + 1
  
  Dim i, H_sum
  H_sum = 0
  
  For i = r_Top To TableObj.Rows.Count
    H_sum = H_sum + TableObj.Rows(i).Height
  Next
  
  Dim H_ave
  H_ave = H_sum / Rcnt
  For i = r_Top To TableObj.Rows.Count
    TableObj.Rows(i).Height = H_ave
  Next

End Sub

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?