実現したいこと
Excelの内容をWordに縦書きで転記したい。
前提
ExcelのシートのA列・B列の内容をWordに縦書きで転記したいのですが、どうしても横書きになってしまいます。
サイトを調べてみて下記のコードを書いたのですが、上手くいかず困っています。
どなたか分かる方がいらしたらご教示いただけますと幸いです。
該当のソースコード
ExcelVBA
ソースコード
Dim lastRow As Long lastRow = Worksheets(2).Cells(Rows.Count, 2).End(xlUp).Row() Dim excelText() As String ReDim excelText(lastRow - 2, 2) As String Dim i As Long For i = 3 To lastRow excelText(i - 3, 0) = Worksheets(2).Cells(i, 1).Value excelText(i - 3, 1) = Worksheets(2).Cells(i, 2).Value & vbCrLf Next i Dim WordApp As Object Dim wordDoc As Object Set WordApp = CreateObject("Word.Application") WordApp.Visible = True Set wordDoc = WordApp.Documents.Add With wordDoc.PageSetup .Orientation = wdTextOrientationVerticalFarEast End With For i = 0 To lastRow - 3 wordDoc.Range.InsertAfter excelText(i, 0) & " " & excelText(i, 1) Next i
試したこと
Orientationの部分をwdOrientPortraitや数字の1にしてみましたができませんでした。

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2023/08/10 04:24