Monday, January 4, 2010

Get a Recently Created File in desired Folder

Set objFileSysOb = CreateObject("Scripting.FileSystemObject")

Set colFolderName = objFileSysOb.GetFolder("E:\Baba_CRN\CD2\Sent Mail\Tasks\")

Set vFiles =colFolderName.Files

vfiles_cnt=vFiles.count

dim win_ex,get_ex

set win_ex=createobject("wscript.shell")

msgbox vFiles.count

For each i in vFiles

'd=ubound(vFiles)
'msgbox d

d=Split(i,"\")
FileName=d(ubound(d))

set get_ex=objFileSysOb.getfile("E:\Baba_CRN\CD2\Sent Mail\Tasks\"&FileName)

win_ex.popup "FileName is :" & FileName & VBNewLine &"Date Created :"&get_ex.datecreated,1,"Name & Created Date of a File"

' msgbox get_ex.datecreated
' msgbox Date

dd=split(get_ex.datecreated," ")

fil_dat=dd(Lbound(dd))

win_ex.popup fil_dat,1,"file date"

if (trim(Date)=trim(fil_dat)) then

win_ex.popup "File is created on "&Date,1,"File creation on"

Exit For

Else

win_ex.popup "File is created earlier",1,"File creation on"

End if

Next

File=FileName

msgbox File

dim xl

set xl=createobject("excel.application")

xl.visible=true

xl.workbooks.open (get_ex)

set xl=nothing

' win_ex.popup "System Date is :"&Date,1,"System Date"

set win=nothing

set objFileSysob=nothing

set colFolderName=nothing


Thanks & Regards
Baba Fakruddin.D
baba.fakru@gmail.com

No comments:

There was an error in this gadget