このGistに上がっているVBAソースファイルの概要
- Haiku-word.vb : Ver. 1.0, Wordの文章に俳句を縦書きで出力するモジュールです。
- Haiku-word2.vb : Ver. 1.1, 俳句を縦書きのテキストボックスに出力するモジュールです。
- Haiku-word3.vb : Ver. 1.2, Wordの文章に、ユーザーフォームから入力した任意の俳句を縦書きで出力するモジュールです。
このGistに上がっているVBAソースファイルの概要
' Auther : Nia Tomonaka | |
' Twitter : https://twitter.com/nia_tn1012 | |
Option Explicit | |
Sub Haiku() | |
With ActiveDocument.Content | |
' vbCrLfは改行記号です。 | |
.Text = "初桜" + vbCrLf + "折しも今日は" + vbCrLf + "よき日なり" | |
' フォントを行書体にします。 | |
.Font.name = "HGS行書体" | |
.Font.Size = "30" | |
' 文字方向を縦書きにします。 | |
.Orientation = wdTextOrientationVerticalFarEast | |
End With | |
End Sub | |
' Haiku-word.vb ( WordのVBA用 ) | |
' Copyright (c) 2014-2015 Myoga-TN.net All Rights Reserved. | |
' This software is released under the MIT License. | |
' http://opensource.org/licenses/mit-license.php |
' Auther : Nia Tomonaka | |
' Twitter : https://twitter.com/nia_tn1012 | |
Option Explicit | |
Sub Haiku() | |
' 縦書きのテキストボックスを作成します。 | |
' ActiveDocument.PageSetupのLeftMarginとTopMarginで、印刷領域の左上の位置を取得します。 | |
ActiveDocument.Shapes.AddTextbox( _ | |
msoTextOrientationVerticalFarEast, _ | |
ActiveDocument.PageSetup.LeftMargin, _ | |
ActiveDocument.PageSetup.TopMargin, _ | |
180, 300) _ | |
.Select | |
' テキストボックスに文字列とフォントを設定します。 | |
With Selection | |
.Text = "初桜" + vbCrLf + "折しも今日は" + vbCrLf + "よき日なり" | |
.Font.name = "HGS行書体" | |
.Font.Size = "30" | |
End With | |
End Sub | |
' Haiku-word3.vb ( WordのVBA用 ) | |
' Copyright (c) 2014-2015 Myoga-TN.net All Rights Reserved. | |
' This software is released under the MIT License. | |
' http://opensource.org/licenses/mit-license.php |
' Auther : Nia Tomonaka | |
' Twitter : https://twitter.com/nia_tn1012 | |
' ユーザーフォーム(HaikuRegister)にテキストボックス | |
' (Phrase1、Phrase2、Phrase3)を用意し、そこに俳句を入力します。 | |
' 俳句を生成するボタンを押すとこのイベントが呼び出されます。 | |
Private Sub Register_Click() | |
With ActiveDocument.Content | |
' vbCrLfは改行記号です。 | |
.Text = Phrase1.Text + vbCrLf + Phrase2.Text + vbCrLf + Phrase3.Text | |
' フォントを行書体にします。 | |
.Font.name = "HGS行書体" | |
.Font.Size = "30" | |
' 文字方向を縦書きにします。 | |
.Orientation = wdTextOrientationVerticalFarEast | |
End With | |
Unload HaikuRegister | |
End Sub | |
' Haiku-word2.vb ( WordのVBA用 ) | |
' Copyright (c) 2014-2015 Myoga-TN.net All Rights Reserved. | |
' This software is released under the MIT License. | |
' http://opensource.org/licenses/mit-license.php |