VBScript Enhancement

Discussion in 'Software' started by r0mmel, Jan 18, 2012.

  1. r0mmel

    r0mmel Private E-2

    Hi Everyone,

    I found a VBScript from the internet that automatically sends an email through Outlook. It is working fine but when I integrated it with another application (Informatica Powercenter). The process doesn't stop.

    I hope you guys could help me enhance this code so that it would terminate itself after running.

    Here's the code:

    Code:
    Dim objOutl
    Set objOutl = CreateObject("Outlook.Application")
    Set objMailItem = objOutl.CreateItem(olMailItem)
    'comment the next line if you do not want to see the outlook window
    'objMailItem.Display
    strEmailAddr  = "me@email.com"
    objMailItem.Recipients.Add strEmailAddr
    objMailItem.Subject = "Test Email from PowerCenter"
    objMailItem.Body = "Hi, this is only a test."
    objMailItem.Attachments.Add "C:\file.csv"
    objMailItem.Send
    Set objMailItem = nothing
    Set objOutl = nothing
    Thanks,
    r0mmel
     
  2. GermanOne

    GermanOne Guest

    I don't have Outlook installed, hence I can't test my suggestion.
    Other Office applications accept the .Quit method and I see no reason why Outlook should have a different behaviour.
    Try
    Code:
    .
    .
    .
    Set objMailItem = nothing
    objOutl.Quit
    Set objOutl = nothing
    
    Regards
    GermanOne
     
  3. r0mmel

    r0mmel Private E-2

    Thanks GermanOne!
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds