|
-
Mar 27th, 2001, 12:00 PM
#1
Thread Starter
New Member
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...
-
Mar 27th, 2001, 12:13 PM
#2
Hyperactive Member
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...
-
Mar 27th, 2001, 12:20 PM
#3
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"
-
Mar 27th, 2001, 01:07 PM
#4
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"
-
Mar 30th, 2001, 02:25 AM
#5
Thread Starter
New Member
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...
-
Mar 30th, 2001, 02:34 AM
#6
since the picture is referenced from the database, why don't you delete it at the same time the database entry is removed?
-
Mar 30th, 2001, 06:41 AM
#7
Thread Starter
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|