Code:Dim objEx As Object Set objEx = CreateObject("excel.application") objEx.workbooks.Open FileName:="C:\path\file.xls" 'change to your file objEx.Visible = False objEx.range("B1").Select objEx.Selection.NumberFormat = "General" objEx.range("B1").Formula = "=COUNTA(A:A)" tmp = objEx.range("B1").Value Dim Carlist() As String ReDim Carlist(tmp) As String For x = 1 To tmp Carlist(x) = objEx.range("A" & x).Value 'this is going on the assumption that Column A holds the Key Field MsgBox Carlist(x) Next x objEx.displayalerts = False objEx.quit filetmp = Dir(App.Path & "\images\*.jpg") 'change to path... Do While Len(filetmp) filetmp = Left$(filetmp, Len(filetmp) - 4) For x = 0 To UBound(Carlist) If Carlist(x) = filetmp Then GoTo Cont Next Kill App.Path & "\images\" & filetmp & ".jpg" Cont: filetmp = Dir Loop VBBrowser v2.0.6
I hope this gets you going...
any questions...just reply...




Reply With Quote