- - PR -
Excel出力
1
投稿者 | 投稿内容 |
---|---|
|
投稿日時: 2005-03-02 16:35
@準備したExcelファイルのセルに、テキストボックスの文字を入力
Aボタンを押すと、テキストボックスの文字が、準備したExcelファイルのセルに代入 BExcelファイルをクローズ というかんじで、プログラミングを組んでいます。 過去ログを参考に、以下のように組んでみました。 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim xlApp As Excel.Application Dim xlBook As Excel.Workbook Dim xlSheet As Excel.Worksheet xlApp = CType(CreateObject("Excel.Application"), Excel.Application) xlApp.Visible = True xlApp.ScreenUpdating = True xlBook = xlApp.Workbooks.Open(FILENAME) CType(xlBook.Sheets.Item("Sheet1"), Excel.Worksheet).Range("C3").Value = Textbox1.Text System.Runtime.InteropServices.Marshal.ReleaseComObject(xlBook) System.Runtime.InteropServices.Marshal.ReleaseComObject(xlApp) End Sub FILENAMEのところは、開きたいファイルの保存先を入力しなければならないのでしょうか。 できれば、ファイル名を入力することで、そのファイルを開きたいのですが、どうもうまくいきません。 |
1