投稿日 | : 2003/01/25(Sat) 02:02 |
投稿者 | : 花ちゃん |
Eメール | : |
URL | : |
タイトル | : Re: 任意に選択したセルに出力 |
どこが違うかは自分で比較して下さい。
Private Sub Command1_Click()
' Excel の Application、Workbook および Worksheet オブジェクトに対
' するオブジェクト変数を宣言します。
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim R As Integer, C As Integer
' 変数にオブジェクトの参照を代入します。Add メソッドを使って
' 新規 Workbook と Worksheet オブジェクトを作成します。
Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
R = xlApp.ActiveCell.Row
C = xlApp.ActiveCell.Column
Label1.Caption = R & " " & C
xlApp.Visible = True
' Excel のセルに値を代入します。
xlSheet.Cells(R, C).Value = "12" '制作中のために簡単な値
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
End Sub