How to let ZoomToRange work well?

My full code is as below:

zoom_trigger = ParamTrigger( "Go Date", "CLICK HERE" );
if ( zoom_trigger ) {		
	AB = CreateObject( "Broker.Application" );
	AW = AB.ActiveWindow;
	beg_dt = StrToDateTime( "2021/01/20 08:45:00" ); 
	end_dt = StrToDateTime( "2021/01/25 08:45:00" ); 
	AW.ZoomToRange( beg_dt, end_dt );
}

I am working on 15-minute and the code above does nothing.
Q) What is wrong with my code?

Thank you very much :slightly_smiling_face:!

This is OLE call. You need to pass values in OLE-compatible way. AFL DateTime is numeric value that private to AFL and is NOT accepted by OLE. OLE accepts only strings and OLEDATE which is totally different animal. You should just pass dates as string directly, no need to do any conversion.

AB = CreateObject( "Broker.Application" );
	AW = AB.ActiveWindow;
	AW.ZoomToRange( "2021/01/20 08:45:00",  "2021/01/25 08:45:00" );
3 Likes

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.