Results 1 to 5 of 5

Thread: Error in Code to save attachments????

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 1999
    Location
    Caracas, Miranda, Venezuela
    Posts
    69

    Question

    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!!!!!

  2. #2
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    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.
    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

  3. #3
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Actually, almost... need to add the Server object to the CreateObject too... Assuming your working in VBScript in ASP...

    Code:
    Dim out
    Dim myItem
    Set out = Server.CreateObject("outlook.application") 
    Set myItem = out.ActiveInspector.CurrentItem 
    myItem.attachments.Item(1).SaveAsFile PathAttachments
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  4. #4
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    monte96:

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

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 1999
    Location
    Caracas, Miranda, Venezuela
    Posts
    69
    That´s true. I just using VB 5.0 SP3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width