ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Not sure how to do this, not even sure how to ask the question clearly... (https://www.excelbanter.com/excel-worksheet-functions/87204-not-sure-how-do-not-even-sure-how-ask-question-clearly.html)

rich

Not sure how to do this, not even sure how to ask the question clearly...
 
Hi,

I am trying to return the filename of an image in a folder to a
cell.

The images have names like 1001.jpg, 1002.jpg....3555.jpg. The
spreadsheet has a column with a matching Product Code value:

1001, 1002,...3555

There are more Product Code values than images, and I cannot have the
image names listed if an image for them is not in the folder.

I can import the image names manually into a spreadsheet (or any some
program for that matter - if that helps)


Anyone got any ideas on how I might accomplish this?

--
love, light and peace,

rich

Gary''s Student

Not sure how to do this, not even sure how to ask the question cle
 
1. Go to the folder contain the .jpg files
2. Using Notepad, create a file in that folder called pictures.bat
the only line in the file is:

dir *.jpg /b pictures.csv

3. Double-click the .bat file; it will create a file called pictures.csv
4. Double-click pictures.csv and you should have all your filenames in
column A
--
Gary's Student


"rich" wrote:

Hi,

I am trying to return the filename of an image in a folder to a
cell.

The images have names like 1001.jpg, 1002.jpg....3555.jpg. The
spreadsheet has a column with a matching Product Code value:

1001, 1002,...3555

There are more Product Code values than images, and I cannot have the
image names listed if an image for them is not in the folder.

I can import the image names manually into a spreadsheet (or any some
program for that matter - if that helps)


Anyone got any ideas on how I might accomplish this?

--
love, light and peace,

rich


Don Guillett

Not sure how to do this, not even sure how to ask the question clearly...
 
If you want a list of file names, modify this to suit.

Sub FindFiles()
Application.ScreenUpdating = False
Dim FN As String ' For File Name
Dim ThisRow As Long
Dim FileLocation As String
FileLocation = "c:\yourfolder\*.jpg"
FN = Dir(FileLocation)
Do Until FN = ""
ThisRow = ThisRow + 1
Cells(ThisRow, 1) = FN
FN = Dir
Loop
Application.ScreenUpdating = True
End Sub


--
Don Guillett
SalesAid Software

"rich" wrote in message
...
Hi,

I am trying to return the filename of an image in a folder to a
cell.

The images have names like 1001.jpg, 1002.jpg....3555.jpg. The
spreadsheet has a column with a matching Product Code value:

1001, 1002,...3555

There are more Product Code values than images, and I cannot have the
image names listed if an image for them is not in the folder.

I can import the image names manually into a spreadsheet (or any some
program for that matter - if that helps)


Anyone got any ideas on how I might accomplish this?

--
love, light and peace,

rich




rich

Not sure how to do this, not even sure how to ask the questionclearly...
 
Don Guillett wrote:
If you want a list of file names, modify this to suit.

Sub FindFiles()
Application.ScreenUpdating = False
Dim FN As String ' For File Name
Dim ThisRow As Long
Dim FileLocation As String
FileLocation = "c:\yourfolder\*.jpg"
FN = Dir(FileLocation)
Do Until FN = ""
ThisRow = ThisRow + 1
Cells(ThisRow, 1) = FN
FN = Dir
Loop
Application.ScreenUpdating = True
End Sub




Thanks, the list of file names is not really the problem. I can get that
from Directory Opus. I thought someone might have a cunning method
precanned. I have not used spreadsheets in the past very often and never
to do anything more complicated than simple invoices, etc.

The real thing is the function that checks a column containing the names
(lots of random images are missing) and returns the name if it finds it
to the correct row.

sort of like this:

get product code (C1)

compare to list of image names

if found return product code or image name (put the result into B2)

else return nothing.

Don Guillett

Not sure how to do this, not even sure how to ask the question clearly...
 
It seems that if you already have the product codes and you already have a
list of the file name you can just make a lookup table with the codes in col
a and the filename in col b and then just use a simple VLOOKUP function.

--
Don Guillett
SalesAid Software

"rich" wrote in message
...
Don Guillett wrote:
If you want a list of file names, modify this to suit.

Sub FindFiles()
Application.ScreenUpdating = False
Dim FN As String ' For File Name
Dim ThisRow As Long
Dim FileLocation As String
FileLocation = "c:\yourfolder\*.jpg"
FN = Dir(FileLocation)
Do Until FN = ""
ThisRow = ThisRow + 1
Cells(ThisRow, 1) = FN
FN = Dir
Loop
Application.ScreenUpdating = True
End Sub




Thanks, the list of file names is not really the problem. I can get that
from Directory Opus. I thought someone might have a cunning method
precanned. I have not used spreadsheets in the past very often and never
to do anything more complicated than simple invoices, etc.

The real thing is the function that checks a column containing the names
(lots of random images are missing) and returns the name if it finds it to
the correct row.

sort of like this:

get product code (C1)

compare to list of image names

if found return product code or image name (put the result into B2)

else return nothing.





All times are GMT +1. The time now is 08:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com