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

Macro does not work

Hi,

I have some macro that was used in the past for get yesterday, get last 7 days and get last month.

For some reason it does not work anymore. Inside I have more macros that i need - but i don't really know the syntax, so i don't know how to delete them correctly . So i need from here just sub getYesterday,sub getLast7Days,sub getMTY.

Who can help me:

1, To leave here just subs  I need.

2.Find why  it did not work anymore.

Thanks a lot.

sub Sort



set chart1 = ActiveDocument.GetSheetObject("CH27")

chart1.SortBy 3



end sub



sub Sort2



'

set chart1 = ActiveDocument.GetSheetObject("CH27")

chart1.SortBy 10





end sub







sub SortCost



'

set chart1 = ActiveDocument.GetSheetObject("CH27")

chart1.SortBy 12





end sub



sub sortGPN



set chart1 = ActiveDocument.GetSheetObject("CH27")

chart1.SortBy 6



end sub



sub sortRev



set chart1 = ActiveDocument.GetSheetObject("CH27")

chart1.SortBy 7



end sub



sub sortGPN_P



set chart1 = ActiveDocument.GetSheetObject("CH27")

chart1.SortBy 8



end sub



sub sortConvs



set chart1 = ActiveDocument.GetSheetObject("CH27")

chart1.SortBy 9



end sub



sub sortRevNetECPM



set chart1 = ActiveDocument.GetSheetObject("CH27")

chart1.SortBy 4



end sub



sub sortCostECPM



set chart1 = ActiveDocument.GetSheetObject("CH27")

chart1.SortBy 5



end sub



sub getYesterday

ActiveDocument.GetField("Date").Select _

ActiveDocument.Evaluate("'>' & date(today(1)-2)")



set group = ActiveDocument.GetGroup("newTime")

set gp = group.GetProperties

gp.FieldDefs(0).Name="Date"

group.SetProperties gp

group.Cycle 1     

gp.FieldDefs(1).Name="YearMonth"

group.SetProperties gp



end sub





sub getYesterdayCre

ActiveDocument.GetField("Date").Select _

ActiveDocument.Evaluate("'>' & date(today(1)-2)")



set group = ActiveDocument.GetGroup("newTime")

set gp = group.GetProperties

gp.FieldDefs(0).Name="Date"

group.SetProperties gp

group.Cycle 1     

gp.FieldDefs(1).Name="YearMonth"

group.SetProperties gp



end sub



sub getLast7Days

ActiveDocument.GetField("Date").Select _

ActiveDocument.Evaluate("'>' & date(today(1)-8)")



set group = ActiveDocument.GetGroup("newTime")

set gp = group.GetProperties

gp.FieldDefs(0).Name="Date"

group.SetProperties gp

group.Cycle 1     

gp.FieldDefs(1).Name="YearMonth"

group.SetProperties gp

end sub



sub getLast7DaysCre

ActiveDocument.GetField("Date").Select _

ActiveDocument.Evaluate("'>' & date(today(1)-8)")



set group = ActiveDocument.GetGroup("newTime")

set gp = group.GetProperties

gp.FieldDefs(0).Name="Date"

group.SetProperties gp

group.Cycle 1     

gp.FieldDefs(1).Name="YearMonth"

group.SetProperties gp

end sub

sub getMTY

ActiveDocument.GetField("Date").Select _

ActiveDocument.Evaluate("'>=' & MonthStart(date(today(1)))")



set group = ActiveDocument.GetGroup("newTime")

set gp = group.GetProperties

gp.FieldDefs(0).Name="Date"

group.SetProperties gp

group.Cycle 1     

gp.FieldDefs(1).Name="YearMonth"

group.SetProperties gp

end sub



sub getMTYcreative

ActiveDocument.GetField("Date").Select _

ActiveDocument.Evaluate("'>=' & MonthStart(date(today(1)))")



set group = ActiveDocument.GetGroup("newTime")

set gp = group.GetProperties

gp.FieldDefs(0).Name="Date"

group.SetProperties gp

group.Cycle 1     

gp.FieldDefs(1).Name="YearMonth"

group.SetProperties gp

end sub





sub FitToWin

ActiveDocument.ActiveSheet.FitZoomToWindow

Application.WaitForIdle

ActiveDocument.ActiveSheet.ApplyZoomToAllSheets

end sub

0 Replies