Help us understand the problem. What is going on with this article?

VBAでExcelに数式(TeXみたいなやつのほう)を挿入

More than 1 year has passed since last update.

Officeの数式をVBAで書くにはどうすればいいかというメモ。

検索すると、Excelのセルで計算するほうの数式が引っかかってしまい、欲しい答えになかなかたどり着かなかった。

参考

コード

Sub InsertEquation(left, top, str)
    ActiveSheet.Shapes.AddLabel(msoTextOrientationHorizontal, left, top, 0, 0).Select
    Application.CommandBars.ExecuteMso "InsertBuildingBlocksEquationsGallery"
    Selection.Text = str
    Selection.Font.Size = 24
    Selection.ShapeRange.TextFrame2.WordWrap = msoFalse
    Application.CommandBars.ExecuteMso "EquationProfessional"
End Sub

Sub Sample()
    InsertEquation 30, 40, "F(t)=\sum_(x=0)^(n-1) \of \begin f(x) e^(-\ii  2\pi tx/N) \end"
End Sub

vba_insert_equation.png

HMMNRST
計算資源は有限。効率よく使って、浮いた分で思い切り遊びたい。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away