Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am trying to create a macro that will output a HTML format table. I want the selection to include any records with a date 90 days ago or newer.
While i can output the HTML table ok i cannot select the date range. I realise the macro has a fixed date which works fine but I need to include all dates from then to the present.
My Macro is simply
sub OnReload()
ActiveDocument.Fields("AllocationDateAHR").select Date-90
ActiveDocument.GetSheetObject("TB08").ExportHtml "\\san\Common\Allocations\Test.html"
end sub
I have tried set analysis in the above macro but it is not recognised.
All suggestions welcome.
Thanks
Clive
Try this:
ActiveDocument.Fields("AllocationDateAHR").select ">=" & Date-90
maybe: "=today()-90"
If not, create a variable defined as =today()-90 and bring the value of the variable into your macro.
Thanks m
The statement ActiveDocument.Fields("AllocationDateAHR").select Date-90 actually works for selecting a single day but what I cannot figure out is how to capture all the dates after that. The script does not like < symbols.
Try this:
ActiveDocument.Fields("AllocationDateAHR").select ">=" & Date-90
M
You have nailed it with this one. Thanks for your input it has been really helpful.
Clive