|
-
Apr 28th, 2015, 09:15 AM
#1
Thread Starter
New Member
Excel Process won't turn off
After I run my code, the Excel process in the Task Manager will not go away. Here is the code:
Sub SavePartNumbersInSession()
Dim ExcelObj As Object
Dim i As Integer
Dim j As Integer
ExcelObj = CreateObject("Excel.Application")
ExcelObj.WorkBooks.Open(sPath + System.IO.Path.GetFileName(MyFile.PostedFile.FileName))
i = 1
j = 2
Session("PartNumbers") = ""
Do Until ExcelObj.Workbooks(1).WorkSheets(1).cells(1, i).value & "" = ""
If ExcelObj.Workbooks(1).WorkSheets(1).cells(1, i).value = "Part Number" Then
ExcelObj.Workbooks(1).WorkSheets(1).UsedRange.Columns(i).NumberFormat = "@"
Do Until ExcelObj.Workbooks(1).WorkSheets(1).cells(j, i).value & "" = ""
If IsNumeric(ExcelObj.Workbooks(1).WorkSheets(1).cells(j, i).value) Then
If Session("PartNumbers") <> "" Then
Session("PartNumbers") &= "|"
End If
Session("PartNumbers") &= CStr(ExcelObj.Workbooks(1).WorkSheets(1).cells(j, i).value)
End If
j = j + 1
Loop
End If
i = i + 1
Loop
ExcelObj.DisplayAlerts = False
ExcelObj.Workbooks(1).Close()
ExcelObj.Quit()
ExcelObj = Nothing
End Sub
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|