PDA

Click to See Complete Forum and Search --> : Error in Code to save attachments????


Rafael
Sep 27th, 2000, 04:43 PM
I used this code to save attachments inserted in an e-mail.

Dim out As Outlook.Application
Dim myItem As MailItem
Set out = CreateObject("outlook.application")
Set myItem = out.ActiveInspector.CurrentItem
myItem.attachments.Item(1).SaveAsFile PathAttachments

Then Message error is :
Object variable or with block variable not set!!!

What is happened????

Please help me!!!!!

RealisticGraphics
Sep 28th, 2000, 06:05 PM
I imagine you figured this out from the e-mail I sent you but just in case, remove the "as" and everything after it in each dim statement and you should be fine I think.

monte96
Sep 28th, 2000, 07:24 PM
Actually, almost... need to add the Server object to the CreateObject too... Assuming your working in VBScript in ASP...


Dim out
Dim myItem
Set out = Server.CreateObject("outlook.application")
Set myItem = out.ActiveInspector.CurrentItem
myItem.attachments.Item(1).SaveAsFile PathAttachments

RealisticGraphics
Sep 29th, 2000, 04:32 PM
monte96:

Good point, but the way he explained the e-mails he sent I think he was using vbscript without any ASP.

Rafael
Sep 29th, 2000, 05:08 PM
Thatīs true. I just using VB 5.0 SP3