ACCESS Excelオートメーションメモ
- ACCESS
-
2012-01-21 - 更新:2012-12-19
この記事は最終更新日から1年以上経過しています。
Dim xlApp As Object
Dim xlBook As Object
Dim xlSheet As Object
Dim FileName As String
Dim myFileName As String
Dim myShape As Object
FileName = Environ("USERPROFILE") & "\デスクトップ\sample.xls"
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.WorkSheets(1)
With xlSheet
.Range("A18:D18").MergeCells = True 'セルを結合
.Range("A18").HorizontalAlignment = -4108 '横位置を中央揃えに
.Range("A18").Font.Size = 48 'フォントの大きさを変更
End With
'保存
xlBook.Saveas (FileName)
xlBook.Close
xlApp.Application.Quit
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
この記事がお役に立ちましたらシェアお願いします
3,416 views




