Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Why if I can not send Chart Or pivot without activate sheet?

Why if I can not send Chart Or pivot without activate sheet? This picture is blank when i received this email. it's different when i activate the sheet before send the object by email.

Thanks

2 Replies
Miguel_Angel_Baeyens

Hi,

What code are you using? Is that a macro? Are you running Server? What picture do you mean? How are you sending email? How are you exporting the chart? Please take some time to detail your environment, tests already run and expected results.

Miguel

Not applicable
Author

I want using macro. This is my code :

sub ReloadData

    TransFileImage()

end sub

sub TransFileImage()

    dim theDate

    dim filename

    if len(CStr(Month(Date()))) = 1 then

        theDate = CStr(Day(Date())) & "0" & CStr(Month(Date())) & CStr(Year(Date()))

    else

        theDate = CStr(Day(Date())) & CStr(Month(Date())) & CStr(Year(Date()))

    end if

    filename = "C:\Test " & theDate & ".jpg"

    call ExportToExcelImage(filename)

end sub

sub ExportToExcelImage(filename)

    'ActiveDocument.Sheets("SH01").Activate

    Set obj = ActiveDocument.GetSheetObject("CH01")

    obj.ExportBitmapToFile filename

    set o = Nothing

    call SendEmail(filename)

end sub

sub SendEmail(attachment)

    Dim strMailTo

    Dim ObjSendMail

    Set objSelected = ActiveDocument.Fields("EMAILIDS").GetPossibleValues

   

    if objSelected.Count = 0 then

        msgbox ("No e-mail reciepient selected")

        exit sub

    else

        set s = ActiveDocument.Variables("vSubject")

        varSubject = s.GetContent.String

       

        set b = ActiveDocument.Variables("vBody")

        varTextBody = b.GetContent.String

       

        Set ObjSendMail = CreateObject("CDO.Message")

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

        ObjSendMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "172.20.30.100"

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

        ObjSendMail.Configuration.Fields.Update

       

        ObjSendMail.AddAttachment attachment

        For i = 0 to objSelected.Count-1

            ObjSendMail.To = objSelected.item(i).Text

            ObjSendMail.Subject = varSubject

            ObjSendMail.From = "danny@yahoo.com"

            ObjSendMail.TextBody = varTextBody

            ObjSendMail.Send

        next

       

        Set ObjSendMail = Nothing

    end if

end sub

May be someone can complete my code. it can't send email if Button which run this module is not appear on activate sheet.

Thanks