下面vb代码段中的 xlApp.Quit 语句为什么不能把进程中的excell.exe进程给k掉啊?
我上外网查了下,都没有人能解决.
各位大虾帮帮我啊
'============================================================================
Option Explicit
Private Sub Command1_Click()
Dim s As String
s = Read_Title_From_Excel("c:\lzyin.xls", 2)
Print s
End Sub
Public Function Read_Title_From_Excel(File_Path As String, Title_Row_Num As Integer) As String
'函数用于从以File_Path为路径的Excel文件中Title_Row_Num行提取标题
'初次上传使用,以后的标题则直接从数据库读取
'打开Excel表,提取出标题行,并将之转换为|号分隔的字符串形式
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim I As Integer
Dim strTemp As String
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open(File_Path)
Set xlSheet = xlBook.Worksheets(1)
strTemp = ""
I = 1
While xlSheet.Cells(Title_Row_Num, I) <> ""
strTemp = strTemp & xlSheet.Cells(Title_Row_Num, I) & "|"
I = I + 1
Wend
xlBook.Close
Set xlSheet = Nothing
Set xlBook = Nothing
xlApp.Quit
Set xlApp = Nothing
Read_Title_From_Excel = strTemp
End Function
'============================================================================