Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

generate an excel file by a button click using macro

Hi,

My requirement is like this

Is it possible to generate an excel file for the editscript code only, not for the object by the button click of the macro.

If you are not understand my explanation, please reply me and i will explain clearly about my requirement.

Thanks...

27 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   I would like to know more about what you want to do.

   Can you please describe in details

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Hi Kaushik,

Thanks for your reply,

Capture.PNG

The Macro code for the button is like this.

sub Export_Excel
                               

    set obj = ActiveDocument.GetSheetObject("TB01") 
   
    obj.ExportBiff "D:\Kumar\New\MyEcel"&Date()&".xls"
   
    MsgBox("Data Has Been Transfer into Excel in D:\Kumar\New With Name of MyEcel")

    End Sub

And like above i am able to export my object data to excel sheet and also possible to generate a qvd file for the object data.

But, My requirement is I have to export the data to an excel sheet and also generate a qvdfile for what i have in the editscript like this without using the objectID like above.

Customers:

LOAD Address,

    City,

    CompanyName,

    ContactName,

    Country,

    CustomerID,

    DivisionID,

    Fax,

    Phone,

    PostalCode,

    StateProvince;

SQL SELECT *

FROM Customers;

Hope so , You understand my explanation .

if you still want any details please reply me.I am waiting for your reply.

Is it possible to do like that?...

Thanks.....

Not applicable
Author

Hi Kaushik,

Thanks for your reply,

Capture.PNG

The Macro code for the button is like this.

sub Export_Excel
                               

    set obj = ActiveDocument.GetSheetObject("TB01") 
   
    obj.ExportBiff "D:\Kumar\New\MyEcel"&Date()&".xls"
   
    MsgBox("Data Has Been Transfer into Excel in D:\Kumar\New With Name of MyEcel")

    End Sub

And like above i am able to export my object data to excel sheet and also possible to generate a qvd file for the object data.

But, My requirement is I have to export the data to an excel sheet and also generate a qvdfile for what i have in the editscript like this without using the objectID like above.

Customers:

LOAD Address,

    City,

    CompanyName,

    ContactName,

    Country,

    CustomerID,

    DivisionID,

    Fax,

    Phone,

    PostalCode,

    StateProvince;

SQL SELECT *

FROM Customers;

Hope so , You understand my explanation .

if you still want any details please reply me.I am waiting for your reply.

Is it possible to do like that?...

Thanks.....

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   You said you want to create a qvd file. But i am unable to understand, that what data you want in QVD. The data of excel or the data of QVW file

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Hi Kaushik,

Thanks for your reply,

I want for the QvwFile.

Thanks.....

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   Can you please upload the qvw file.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Hi Kaushik,

Sure , You can found the example of my qvw file with this post.

Thanks...

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

    Create a new list box with $Table... set object Id to LB01 and

    Add below code in your Module

sub gen_qvd
rem ** show each possible value in list box **
set docprop = ActiveDocument.GetProperties
set LB = ActiveDocument.GetSheetObject("LB01")
boxvalues=LB.GetPossibleValues
for i = lbound(boxvalues) to ubound(boxvalues) 
   docprop.Script = docprop.Script & chr(10) & "Store " & boxvalues(i) & " Into ../"  & boxvalues(i) & ".qvd;"
ActiveDocument.SetProperties docprop
Next

ActiveDocument.Reload
end sub

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Hi Kaushik,

The code you sent is working fine.But, my requirement is not like that

After reloading the data from the editscript you take it into one object and in the macrocode you supplying that objectID there and you are getting the result.

But My requirement is you found the table fields in the editscript.For those fields I have to generate a qvd from the frontend button without taking any object support.(ie, don't use ActiveDocument.GetSheetObject("  ")).

Is it possible to do like that?...

Do you want any more details regarding this Reply me. I will explain clearly.

Waiting for your reply...

Thanks .....