Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Exel.Exe lingering in Task Manager
Hello,
I have some VBA code in which I changing dates from Euro style to U.S. From MS Access I create an Excel Object and change the dates. I then quit but it still hangs around. Any clues? Option Explicit Sub ConvertAllDates() DoCmd.SetWarnings False Dim appShipments As Excel.Application Set appShipments = CreateObject(Class:="Excel.application") appShipments.Workbooks.Open Filename:="myfilename.xls" Dim shtShipments As Worksheet Set shtShipments = appShipments.Workbooks(1).Worksheets("WorkSheetNam e Dim CelNum As Integer Dim thisCol As String, newdate As Variant Dim THIScol2 As String Dim thiscol3 As String thisCol = "C" THIScol2 = "G" thiscol3 = "H" Dim IntRowCount As Integer IntRowCount = appShipments.ActiveSheet.Range("c1").CurrentRegion .Rows.Count For CelNum = 1 To IntRowCount newdate = ConvertDate(Cells(CelNum, thisCol)) newdate = ConvertDate(Cells(CelNum, THIScol2)) newdate = ConvertDate(Cells(CelNum, thiscol3)) If newdate < 0 Then Cells(CelNum, thisCol).Value = newdate Cells(CelNum, THIScol2).Value = newdate Cells(CelNum, thiscol3).Value = newdate End If Next appShipments.Workbooks("myfilename.xls").Save appShipments.Workbooks("myfilename.xls").Close appShipments.Quit Set appShipments = Nothing DoCmd.OpenTable tablename:="Shipments" DoCmd.RunCommand acCmdSelectAllRecords DoCmd.RunCommand acCmdDelete DoCmd.Close acTable, objectname:="Shipments" DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel7, _ tablename:="Shipments", _ Filename:="myfilename.xls", _ hasfieldnames:=True DoCmd.SetWarnings True End Sub Function ConvertDate(sDate As String) As Date Dim mth As Integer, yr As Integer, dy As Integer On Error GoTo trap mth = CInt(Mid(sDate, 4, 2)) yr = CInt(Right(sDate, 2)) dy = CInt(Left(sDate, 2)) ConvertDate = DateSerial(yr, mth, dy) Exit Function trap: 'MsgBox Error Err.Clear ConvertDate = 0 End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
excel.exe is not terminating from task manager | Excel Programming | |||
Task Manager and Excel 2003 | Excel Discussion (Misc queries) | |||
EXCEL keeps running in task manager | Excel Programming | |||
get the program id of an excel application from the task manager | Excel Programming |