3 Replies Latest reply: Nov 15, 2012 7:45 AM by stefano marson RSS

    Ending an external task

    HofbauerAn

      Hi,
      I started an external task, which execute a macro, which sends an Excel Table via Email, in an QlikView Document.

      The task runs succsessfully and I recieve the email, but in the Enterprise Management Console the Task is running wihtout ending, weather the Mail have been distributed. So, every time I have to stop the reload by myself and the reload fails.


      What can I do, that the reload stops itself, when finishing distirbution?
      Here's the VBA-Script from my QlikView document:

      '################################EMAIL-HANDLING FUNCTION#################################


      Public Function SendMail (SendTo, Subject, Body, Attachment)
      ', Attachment, SendCC, SendBCC)


      Set objMessage = CreateObject("CDO.Message")
      objMessage.Subject = Subject
      objMessage.From = "QlikviewPublisher@XXX.de"
      objMessage.To = SendTo
      objMessage.CC = SendCC
      objMessage.BCC = SendBCC
      objMessage.TextBody = Body
      'msgbox Attachment
      if( not "" = Attachment) then
      objMessage.AddAttachment Attachment
      end if

      objMessage.Configuration.Fields.Item _
      ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

      objMessage.Configuration.Fields.Item _
      ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "RE-XX.XX-XX.TEDA"

      objMessage.Configuration.Fields.Item _
      ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

      objMessage.Configuration.Fields.Update

      objMessage.Send
      End Function


      sub email()
      'Set oShell = CreateObject("WScript.Shell")'
      'set fso = CreateObject("Scripting.FileSystemObject")
      path = "C:\Temp\Myexport.xls"
      'If fso.FileExists(path) Then
      'set excelFile = fso.GetFile(path)
      'excelFile.Delete
      'end if

      Application.Sleep(1000)

      set obj = ActiveDocument.GetSheetObject("CH02")
      obj.ExportBiff path


      Application.Sleep(1000)


      call sendmail("test.test@email.de", "Your Excel report","See attached Excel doc for details for last 30 days. The full QV report is here: https://xxx.com/xyz", path)
      'ActiveDocument.GetVariable("sendTo").GetContent.String'

      ActiveDocument.ClearAll False

      end sub

      '########################################################################################################'

       

      Thanks for help.