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

Thursday, December 10, 2009

Get all Objects in WebPage irrespective of Class

'Code to get all objects irrespective of Class in WebPage

'systemutil.Run "www.google.com"

Dim des,res,Obj_Name,Obj_Cls,ie,xl

Set ie=createobject("internetexplorer.application")
ie.navigate("www.google.com")
ie.visible=true

Set xl=createobject("excel.application")
xl.visible=true
xl.workbooks.add
xl.sheets("sheet1").select
xl.cells(1,1).value="Object_Class"
xl.cells(1,2).value="Object_Name"

Set des=description.Create
des("visible").value=true

Set res=browser("name:=Google").Page("title:=Google").ChildObjects(des)

Set pop=createobject("wscript.shell")
btn=pop.popup(res.count,3,"Count of Objects in WebPage")
'msgbox res.count

For i=0 to res.count-1

Obj_Cls=res(i).getroproperty("micclass")
Obj_Name=res(i).getroproperty("name")
' print "Class of the Object is: "&output&" Name of Object is: "&val

xl.cells(i+2,1).value=Obj_Cls
xl.cells(i+2,2).value=Obj_Name

Next


Set xl=nothing

Set ie=nothing



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