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

Macro help..!!!

Hi Folks ,

I'm having a macro which is working very well for qlikview filed , but i want this to work for expression . Please help me on this.

Current Scenario : I have created a excel template and this macro is working file for exporting any qlikview filed to the excel template.

But instead of field if I'm calling expression its not working. You can see below I'm calling "Problem Desc." in B9 cell of excel sheet which is working fine.

Now if i changed this fileName ="Test" , it is not working as this is my expression not field . Kindly help me on this.

Attached is my application and Excel Template.

sub sendToExcel

    set XLApp = CreateObject("Excel.Application")

    XLApp.Visible = true

    set XLDoc = XLApp.Workbooks.Open("C:\Users\asaini\Desktop\Sample_A3_Template_BCAQ.xlsm") 'set path to template file

    set XLSheet = XLDoc.Worksheets("A3")

    XLSheet.Activate

    set Doc = ActiveDocument

   

    cellAddress = "B9" 'Cell address to paste data in Excel

    fieldName = "Problem Desc." 'Field name in Qlikview

    pasteData cellAddress, fieldName, Doc, XLSheet

   

   

end sub

sub pasteData(cellAddress, fieldName, Doc, XLSheet)

    SET Field = Doc.Fields(fieldName).GetPossibleValues

    FOR i=0 to Field.Count-1

        value = Field.Item(i).Text

        dataTrans = value

        existingData = XLSheet.Range(cellAddress).Value

        XLSheet.Range(cellAddress).Formula = existingData & chr(10) & dataTrans

    next

end sub

Thanks,

AS

0 Replies