| 
                 分類:[.NET 全般] 
 
 お世話になります
WinXP、VB.NET2005、SQLServer2005と言う環境です
Excelを取り込んで処理をしているのですが、取込後に取り込んだExcelファイルが編集可能ですと言うウィンドが開いてしまうのですが、これを出さない様にしたいのですがどの様にしたら良いのでしょうか
後にも先にもここの場所でしか取込元のファイルを開いてないです
以下が現処理内容です
        Dim oleCn As New OleDb.OleDbConnection()
        Dim oleCm As New OleDb.OleDbCommand()
        Dim oleDa As New OleDb.OleDbDataAdapter()
        Dim dt As New DataTable()
        Dim intRow As Integer = 0
        Dim strWork(5) As String
        Dim strK As String = ""
        Dim xlApp As New Excel.Application()
        Dim xlBooks As Excel.Workbooks = xlApp.Workbooks
        Dim xlBook As Excel.Workbook = xlBooks.Open(Me.txt_パス.Text & ".xls")
        Dim xlSheets As Excel.Sheets = xlBook.Worksheets
        Dim xlSheet As Excel.Worksheet = CType(xlSheets.Item(1), Excel.Worksheet)
        strK = xlSheet.Name
        oleCn.ConnectionString = _
                "Provider=Microsoft.Jet.OLEDB.4.0; " + _
                "Data Source=" & Me.txt_PATH.Text & ".xls" & ";" + _
                "Extended Properties=""Excel 8.0;HDR=YES;IMEX=1;"""
        oleCm.Connection = oleCn
        oleCm.CommandText = "Select * From [" & strK & "$] " 
        Try
            oleDa.Fill(dt)
        Catch ex As Exception
            oleDa.Dispose()
            oleDa = Nothing
            oleCm.Dispose()
            Return False
        End Try
        Do While intRow < dt.Rows.Count - 1
            strWork(0) = dt.Rows(intRow).Item(0).ToString   
            strWork(1) = dt.Rows(intRow).Item(1).ToString   
            strWork(2) = dt.Rows(intRow).Item(2).ToString   
            strWork(3) = dt.Rows(intRow).Item(3).ToString   
            strWork(4) = dt.Rows(intRow).Item(4).ToString   
            strWork(5) = dt.Rows(intRow).Item(5).ToString   
            'エラーチェック
            Call READ_EXCEL_ERR(strWork(0), strWork(1), strWork(2), strWork(3), strWork(4), strWork(5))
            intRow += 1     '次の行へ
        Loop
        oleDa.Dispose()
        oleDa = Nothing
        xlSheet = Nothing
        xlSheets = Nothing
        xlBook.Close()
        xlBook = Nothing
        xlBooks.Close()
        xlBooks = Nothing
        xlApp.Quit()
        xlApp = Nothing
よろしくお願いします
  |