投稿日 | : 2006/09/25(Mon) 21:59 |
投稿者 | : こう |
Eメール | : |
URL | : |
タイトル | : シート名の設定 |
VB6.0からExcelを起動し、保存しようとしています。
その際、シート名も設定したいのですが、どうすればよいのですか。
-------------------
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim str_File As String
Dim str_today As String
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
str_today = Year(Date) & Format(Month(Date), "0#") & Format(Day(Date), "0#")
str_File = "c:\temp\test_" & str_today & ".xls"
処理
xlSheet.SaveAs str_File
xlApp.Quit
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
----------
Set xlSheet = xlBook.Worksheets("test")
とすると、ファイルが作成されません。