掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
VBからExcelの起動 (ID:147973)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
今までは以下のソースでエクセル出力していました。 問題なく動作していたのですが、開発環境のPCをwindows7 のOffice2010に移行したところ、プロジェクトを立ち上げたらエラーが出るようになりました。 'エクセルを開く Dim Xls1 As New Excel.Application() Dim xlBooks As Excel.Workbooks = Xls1.Workbooks Dim xlBook As Excel.Workbook = xlBooks.Open(ExFile) Dim xlSheets As Excel.Sheets = xlBook.Worksheets Dim xlSheet As Excel.Worksheet = xlSheets.Item(1) Dim xlCells As Excel.Range = xlSheet.Cells Dim xlRange As Excel.Range For i = 0 To AZcnt - 1 xlRange = Xls1.Range("A" & CStr(i + 2)) xlRange.Value = H1(i) System.Runtime.InteropServices.Marshal.ReleaseComObject(xlRange) 途中省略 Next '印刷範囲の指定 xlSheet.PageSetup.PrintArea = "A1:C" & CStr(AZcnt + 1) ' Excel を表示する Xls1.Visible = True System.Runtime.InteropServices.Marshal.ReleaseComObject(Xls1) System.Runtime.InteropServices.Marshal.ReleaseComObject(xlBooks) System.Runtime.InteropServices.Marshal.ReleaseComObject(xlBook) System.Runtime.InteropServices.Marshal.ReleaseComObject(xlSheets) System.Runtime.InteropServices.Marshal.ReleaseComObject(xlSheet) System.Runtime.InteropServices.Marshal.ReleaseComObject(xlCells) このソースで、Excel.Application、As Excel.Workbooks などが定義されませんというエラーが出る状態です。 現在、全く違う方法に変えるかどうか悩んでいます。
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.