Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
vamshi_1957
Contributor II

Macro to export a .csv and zip it

Hi,

I have very little knowledge on vb script. I am using the below vb script to export a sheet object to a .csv file.

sub Export

Dim docProp

set docProp = ActiveDocument.GetProperties

Dim tmpFile  'used to create relative filepaths

tmpFile = docProp.MyWorkingDirectory

Dim vSpl  'location of final backslash char

vSpl = InStrRev(tmpFile,"\")

tmpFile = Left(tmpFile,vSpl-1)

vSpl = InStrRev(tmpFile,"\")

tmpFile = Left(tmpFile,vSpl) & "External Data Sources\OperationalReportsOutput\BankruptcyRptSpreadsheet_" & DatePart("YYYY", Now()) & right( "0" & DatePart("m", Now()) ,2) & right( "0" & DatePart("d", Now()) ,2) & ".csv"    

set obj = ActiveDocument.GetSheetObject("CH02")

obj.ExportBiff tmpFile

But, the file forming is more than 25mb and it was not getting attached to the mail and am unable to send the email. So, i need the script to create a zip folder and compress the file. How can i do it. Please help me with your suggestion.

Tags (1)
1 Reply
aderlanrm
Valued Contributor

Re: Macro to export a .csv and zip it

Hi Vamshi,

Sorry the ingles bad.

I don't know with macro, but with script I suggest.

STORE Sample into c:\Temp\Malling.csv (txt, delimiter is ';');

EXECUTE cmd.exe /C c:\WinRAR.exe a -afzip -df c:\Temp\Sample.zip c:\Temp\Malling.csv;

EXECUTE cmd.exe /C del /f/q c:\Temp\Malling.csv;

Bye.

Community Browser