Jump to content

Date variable, Get date from Excel


Recommended Posts

I am trying to set date variable can anyone help?

#include <Date.au3>

$oEX = ObjCreate("excel.Application")

$search = FileFindFirstFile("\\server\folder\blah\*.xls")



Then I want to pick day and month from date like day=1, month=10:





Also I want to get date from Excel and pick day and month like in previous example:

$dan=Date.Day($oWB.WorkSheets("ЕСП").Range("D" & $j).Value)

$mesec=Date.Month($oWB.WorkSheets("ЕСП").Range("D" & $j).Value)

Kind regards,


Link to comment
Share on other sites

Problem with geting day and month from date by excel functions Day and Month

$date=$oWB.WorkSheets("ESP").Range("D" & $j).Value


result is : 20120106000000

Next code is not good result is blank MsgBox:



Same as previous code, blank MsgBox:



Link to comment
Share on other sites

Here is declaration

Dim $oEX, $search,$oWB,$file

$oEX = ObjCreate("Excel.Application")

$search = FileFindFirstFile("F:\RADNI\Prpracun za 2013\Copy of BACKA 2013\*.xls")



If $search = -1 Then

MsgBox(0, "Error", "No files/directories matched the search pattern")



While 1

$file = FileFindNextFile($search)

MsgBox(0,"Tekuci fajl",$file)

If @error Then ExitLoop

$oWB = $oEX.Workbooks.Open("F:\RADNI\Prpracun za 2013\Copy of BACKA 2013\" & $file)

Link to comment
Share on other sites

This one works. Put one date in A1 in Sheet1 for the test:

$FilePath = FileOpenDialog("Please open file","C:\","Excel (*.xls;*.xlsx;*.xlsm)",1)

$oExcel = ObjCreate("Excel.Application")

$oExcel.Visible = 1




$date = $oExcel.WorkSheets("Sheet1").Range("A1").FormulaR1C1


$day = $oExcel.Application.Evaluate("Day("& $date &")")


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...