Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Closing excel?

Status
Not open for further replies.

redsand23

Technical User
Feb 22, 2002
77
US
I have DTS importing a couple of excel files into SQL for which I have linked in a view, I then take the view and dump it into excel which works great. The last step I take the excel file and e-mail it out.

I get the following error, error sending mail: MAPI error: Could not open the attached file.

I am assuming this is happening becuase excel has not closed the file? If I run the e-mail step manually it works fine. I have each step dependent(Completion option) before the next step starts.

Any help would be greatly appreciated.

Thanks in advance
 
Create an ActiveX script with this code inside it and run it just before you send the mail.

'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************

Function Main()

On Error Resume Next
Set oICareExcel = GetObject(, "Excel.Application")
If Err <> 0 Then
On Error GoTo 0
Else
olCareExcel.DisplayAlerts = False
oICareExcel.Workbooks("\\fbsmnas00\departments\Data_Acquisitions\Industry_Folder\Medical\Invacare\2004\products.csv").Close True
oICareExcel.Quit
Set oICareEXcel = nothing

End If
Main = DTSTaskExecResult_Success
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top