Page 1 of 1

AHK: Excel, check data

Posted: 13 Feb 2019, 01:43
by inseption86
Hi guys, I have a cell with the date format dd.MM.yyyy, for some reason my code only works under dd

Code: Select all


Path = %A_Desktop%/*.xlsx
Xl := ComObjCreate("Excel.Application")
Xl.Workbooks.Open(Path) ;выбрать файл для проверки
Xl.Visible := True

loop 100 {

FormatTime, TimeString, 20171020, dd.MM.yyyy
var := Xl.cells(A_Index + 1,7).value 

	IF (var > timestring) {
		MsgBox % var
	}

}


Re: AHK: Excel, check data

Posted: 14 Feb 2019, 05:34
by hd0202
dates can only be usefully compared as yyyy.MM.dd

Code: Select all

Path = %A_Desktop%/*.xlsx
Xl := ComObjCreate("Excel.Application")
Xl.Workbooks.Open(Path) ;выбрать файл для проверки
Xl.Visible := True

loop 100 {

; FormatTime, TimeString, 20171020, dd.MM.yyyy
var := Xl.cells(A_Index + 1,7).value 
formattime, var_ymd, var, yyyyMMdd

;	IF (var > timestring) {
	IF (var_vmd > "20171020") {
		MsgBox % var
	}

}
Hubert