LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel.exe is not terminating from task manager Inthi Excel Programming 0 November 28th 05 01:39 PM
Task Manager and Excel 2003 Mike Excel Discussion (Misc queries) 1 April 20th 05 10:40 PM
EXCEL keeps running in task manager Sam Excel Programming 4 January 22nd 04 11:17 AM
get the program id of an excel application from the task manager nikolaosk[_5_] Excel Programming 2 October 14th 03 03:06 PM


All times are GMT +1. The time now is 10:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"