Page 1 of 1

Gui calendar to excel

Posted: 22 Jun 2018, 15:04
by inseption86
Hi, please help, i have:

Code: Select all


path = .............................xlsx
Xl := ComObjCreate("Excel.Application")
Xl.Workbooks.Open(Path)
Xl.Visible := true

xl.Worksheets(1).activate

 If (xl.Worksheets(1).FilterMode)
	xl.Worksheets(1).ShowAllData

Gui, Add, DateTime, w153 vMyDateTime, 'Date1:' dd.MM.yyyy

Gui, Add, Button, x+5 hp gDateRoutine, Go

Gui, Show

DateRoutine:

Gui, Submit, NoHide
 
FormatTime, Date1, dd.MM.yyyy

 xl.Worksheets(1).Range("A1:AX1").AutoFilter(18, ">=" Date1, xlAnd := 1, "<=" "22.06.2018") 

Is not working

Re: Gui calendar to excel

Posted: 22 Jun 2018, 19:11
by TLM
Please describe exactly what isn't working.
Just from eyeballing the script, you're missing some returns

Code: Select all

;...........
Gui, Show
Return ; << add return or the script will continue to run the below routine!

DateRoutine:

Gui, Submit, NoHide
 
FormatTime, Date1, dd.MM.yyyy
msgbox % Date1
 xl.Worksheets( 1 ).Range( "A1:AX1" ).AutoFilter( 18, ">=" Date1, xlAnd := 1, "<=" "22.06.2018" ) 
Return
Be more specific!

Re: Gui calendar to excel

Posted: 23 Jun 2018, 02:05
by inseption86
TLM wrote: there is a choice of today's date, and not the one that I choose on the calendar

Re: Gui calendar to excel  Topic is solved

Posted: 23 Jun 2018, 05:00
by inseption86
Gui, Add, Text, , First Date:
Gui, Add, DateTime, vFirstDate Section,

Gui, Add, Text, , Second Date:
Gui, Add, DateTime, vSecondDate Section,

Gui, Add, Button, Default, &OK
Gui, Show, w190 h130, Data
Return

ButtonOK:
Gui, submit, nohide

FormatTime, FirstDate , %FirstDate% , dd.MM.yyyy
FormatTime, SecondDate , %SecondDate% , dd.MM.yyyy

xl.Worksheets( 1 ).Range( "A1:AX1" ).AutoFilter( 18, ">=" FirstDate, xlAnd := 1, "<=" SecondDate )

GuiClose:
Gui, Destroy