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

Auto populate date in filename

Good morning,

Using Qlikview version 11, 64-bit edition

I am creating a button for people to easily to print an entire sheet. However, I have an issue in regards a macro i am using to copy an entire sheet to a png/pdf file.

The macro i am using is:

Sub export

ActiveDocument.ActiveSheet.FitZoomToWindow

ActiveDocument.GetApplication.WaitForIdle

ActiveDocument.ActiveSheet.ExportBitmapToFile "C:\Users\Administrator\Desktop\Pending Faults **where current date needs to be**.png"

End sub

I am in the process of transferring some of my Excel reports into Qlikview. For those in my team who use the report, they don't have to worry about the naming convention and the location to copy too, it's all done for them at the click of a button. The Excel macro i use is:

Sub SaveAsPdf()

    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _

        "Y:\Users\Administrator\Desktop\Pending Faults " & Format(Now() , "YYYYMMDD") & ".pdf", Quality _

        :=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _

        OpenAfterPublish:=True

End Sub

How do i go about getting the date working the same in Qlikview as i had in Excel?

Many thanks for your assistance.

Tracey

3 Replies
tamilarasu
Champion
Champion

Hi Tracey,

Sub export

vPath  = "Y:\Users\Administrator\Desktop\Pending Faults"

vToday = ActiveDocument.Evaluate("Date(Today(), 'YYYYMMDD')")

ActiveDocument.ActiveSheet.FitZoomToWindow

ActiveDocument.GetApplication.WaitForIdle

ActiveDocument.ActiveSheet.ExportBitmapToFile  vPath &"\" & vToday & ".png"

End sub

tamilarasu
Champion
Champion

If you want the user to enter the path dynamically, you can use variables in front end. I have attached a sample for your reference. Also, you can find the API guide in below link. You can search qlikview macro examples and syntaxes easily. Good luck.

API GUIDE

Capture.PNG

traceyamcb
Contributor II
Contributor II
Author

Thank you for your reply. This worked very well

I have another question in regards pulling several macros through together, which i will post in another thread.

Kindest Regards

Tracey