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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
d_koti24
Creator II
Creator II

Macro issue

Hi,

My qvw application contains 1 list box (i.e date field) and 1 straight table.
my req is i want to export that straight table to excel and send that excel as a mail attachment,
it was done through macro,it's working fine.nw i want filter out the data based on the date field,
after that i want to export to excel.
for ex:
         datefiled  
         5/10/2015
         5/11/2015
         5/12/2015
now i want to filter the data based on maxdate i.e 5/12/2015,after that i want to export to excel
how to select the max date dynamically through macro.

before exporting the data into excel,i want to select the max date dynamically.

how to achive this.

regards,
koti.

3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

It would be better to create a variable that holds the max(Date) value and read that variable into your macro. The variable would be defined something like

     =Max(Date)

(note the = is part of the variable)

See also Macros are Bad for more

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
tresesco
MVP
MVP

Something like:

vMaxDate = Date(Max(DateField))          // front end variable definition

Sub SelFun

     MaxDate = ActiveDocument.Variables("vMaxDate").GetContent.String

     ActiveDocument.Fields("DateField").Select MaxDate

End Sub

vikasmahajan

PFA

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.