Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Need Help With VBA Script to Export Multiple Object on Single .jpg Page

I have multiple Objects(Line Chart, Text Object etc) on Sheet "SH39" and I want to export specific objects on single page in .jpg format using vba script.

I am able to export either single object or screen shot of what is being displayed but not able to select and export multiple objects.

Thanks in Advance.

Sub QlikPrint()

    Dim Val As Variant

    On Error Resume Next

    Dim objQV As QlikView.Application

    Set objQV = GetObject(, "QlikTech.QlikView")

    If TypeName(objQV) = "Global" Then

            boolLoopAgain = True

        Else

            Set objQV = CreateObject("QlikTech.QlikView")

    End If

    Dim ObjDoc As QlikView.Document

    Set ObjDoc = objQV.OpenDoc("C:\..................................................................\TVM_Dashboard.qvw")

    ObjDoc.Fields("[Matched Pair Name (Dept Name)]").Select ""

    Dim strItemNm As String

    Set Val = ObjDoc.Fields("[Matched Pair Name (Dept Name)]").GetpossibleValues(200)

    For i = 0 To Val.Count - 1

        ObjDoc.GetApplication.WaitForIdle

        Debug.Print i & " of " & Val.Count

        Debug.Print Val.Item(i).Text

        ObjDoc.Fields("[Matched Pair Name (Dept Name)]").Select Val.Item(i).Text

        ObjDoc.GetApplication.WaitForIdle

 

        strItemNm = Replace(Val.Item(i).Text, "/", "_")

        MyCharts = ObjDoc.Sheets("SH39").GetSheetObjects

        MyChartsObj = ObjDoc.Sheets("SH39")

     

        MyCharts = ObjDoc.Sheets("SH39").GetSheetObjects

        MyChartsObj = ObjDoc.Sheets("SH39")

     

            For x = LBound(MyCharts) To UBound(MyCharts)

                       Set obj = ObjDoc.Sheets("SH39").GetSheetObjects(x).GetObjectId

                       If obj="CH431_309715473" And obj="TX560"  And obj="TX558" Then

                                obj.ExportBitmapToFile "C:\......................................................\Qlik Report\" & strItemNm & ".jpg"

                       End If

            Next x

    Next i

End Sub

1 Reply
msmichael
Creator
Creator

Hi Rohit,

Have you found a solution? I have same requirement of exporting multiple objects into an image, but have not found a solution yet..

Thanks,

Michael