tagCANDY CGI VBレスキュー(花ちゃん)の Visual Basic 6.0用 掲示板
VBレスキュー(花ちゃん)の Visual Basic 6.0用 掲示板
[ツリー表示へ]  [ワード検索]  [Home]

タイトル Excelが終了しない
投稿日: 2009/04/13(Mon) 18:23
投稿者RYO
はじめまして。
Excelを操作して、正しい手順でオブジェクトの開放を行なっているのですが、
終了されません。
どなたか原因が分かる方はご教授願えませんでしょうか…?

    Dim xlApp        As Object
    Dim xlBook       As Object
    Dim xlSheet      As Object
    Dim lngRow       As Long
    Dim lngCol       As Long
    Dim aryData      As Variant
    Dim strInputPath As String

    strInputPath = "C:\test.xls"

    '変数にオブジェクトの参照を代入
    Set xlApp = CreateObject("Excel.Application")
    '指定したファイルを開く
    Set xlBook = xlApp.Workbooks.Open(strInputPath)
    Set xlSheet = xlBook.Worksheets(1)
    
    xlApp.ScreenUpdating = False    'Excelの画面更新を停止する
    
    xlSheet.Activate
    
    lngRow = 1
    lngCol = 165
    
    With xlSheet
        Do While Len(Trim$(.Cells(lngRow + 1, 1).Value)) > 0
            lngRow = lngRow + 1
        Loop
        aryData = .Range(Cells(2, 1), Cells(lngRow, lngCol)).Value
    End With

〜〜〜〜〜中略〜〜〜〜〜
    Set xlSheet = Nothing
    xlBook.Close
    Set xlBook = Nothing
    xlApp.Quit
    Set xlApp = Nothing

- 関連一覧ツリー をクリックするとツリー全体を一括表示します)

古いスレッドにレスはつけられません。