Results 1 to 7 of 7

Thread: Can this be done???

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Location
    Lancashire U.K.
    Posts
    3

    Question

    Can any1 advise me if and/or how I can do the following?

    We have a list of used cars that we manipulate using Excel to give a clean list of current stock throughout our group. This list is then uploaded to our website. We want to have images associated to the cars on list using the reg as an id key. We need a way of automating the maintenance of the image files so that when a car is sold we can delete the relevant image from our central directory. The way I imagine it is something to look at the image files and compare the reg to the list. If the reg is not in the list then it would delete the image file. We don't host our website so we have to send the stocklist and image files on a daily basis. I hope this is clear...I appologise if it's not.

    Cheers...

  2. #2
    Hyperactive Member
    Join Date
    Dec 2000
    Location
    Denver
    Posts
    265
    well, it --could-- be done, but using excel in a web based setting for data manipulation is more trouble than it's worth. If your web host will let you use a database (Access, SQL, or whatever) that would be worlds easier. You'll have to get ahold of your web host and see if they have allow you to use databases, and see if they have some type of server side scripting available like ASP, JSP, etc...

  3. #3
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390
    I agree...Database would be better..

    but sure it can be done...

    use the Key to name the image file

    then have your app scan down the column in the excel sheet.. and compare to the image directory..

    if its not there...then kill it!

    This actuall should not be hard at all....
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  4. #4
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    here...

    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...
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Location
    Lancashire U.K.
    Posts
    3

    Wink

    Thanks a lot folks for your help. As yet I have not had time to try anything with the code you supplied. I will let you know how it goes.

    Cheers

    Ezzer...

  6. #6
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628
    since the picture is referenced from the database, why don't you delete it at the same time the database entry is removed?
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  7. #7

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Location
    Lancashire U.K.
    Posts
    3

    Thumbs up

    Geoff_xrx..... I have used your code and it works a treat. It does exactly what it says on the tin...

    You ar a GOD.

    Ezzer...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width