• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Automatic Listing path of Pictures in Cell for merging Data in Indesign

AlexT

New Member
Hi,


I have 900+ pictures catalog to prepare, I am using adobe Indesing and its "merge data" feature to do so. My data source being Excel Files in wish I have to add the path to the pictures wish are going to be inserted in the catalog. I am not saying inserting the pictures in the excel files, but the "path" to them. 900 pict; you may understand that I don't feel like doing them one by one. So, please, what is the way to list the pictures path automatically in the column? Is their a way to just by tell excel in wish folder to look?


Thanks for your help, I am desperate.
 
AlexT


What about in a Dos CMD window doing a Dir /S /N *.jpg > mypics.txt


Goto the Windows Start Menu and type CMD in the Run dialog

Change to the appropriate directory

Dir /S /N *.jpg > mypics.txt

This will make a file called mypics.txt


Import mypics.txt into Excel

Reformat as appropriate
 
Hi, AlexT!


Far beyond from the scope of this topic, but I think that if you have to do this repeatedly, maybe you want to give a look to this topic:

http://chandoo.org/forums/topic/excel-files-documenting-inspector


Regards!
 
@hui: Hi, Thanks, but I Can't use the .txt file create this way in excel, I need the full path something like:


E:Graphic design projectClientclient Catalogueimagecatalog pictureBABY CARE***.psd


@SirJB7: Hi Thanks, but I can't open the link provide in this topics... I am in china they have some stupid internet rules.
 
I did say you'll need to Reformat as appropriate

You will need to use a few helper columns to append the path to the file names
 
Yeah that the point, I do not have time to do that, got more than 1200 items now and counting. I did find some useful macros which display the path and the file name in the cells. It is better even if the path and file name are in 2 different column, it just require a simple copy an paste operation.
 
Hi, AlexT!


Let me see if we can achieve the goal manually.


1) Place this code within a module (Alt-F11, Insert, Module)

-----

Option Explicit

' constants
' workbooks
Const gksWorkbooks = "Workbooks"
Const gksWorkbooksTable = "WorkbooksTable"
' columns
Const gkiWorkbookgsPath = 1
Const gkiWorkbooksFile = 2
Const gkiWorkbooksCreationDate = 3
Const gkiWorkbooksModificationDate = 4
Const gkiWorkbooksErrors = 5

' declarations
Dim gI As Long, grng As Range, gsPath As String, gsFileName As String

Sub FolderAnalysis()
'
' constants
'
' declarations
Dim fso As Object, fld As Object
'
' start
' folder selection
With Application.FileDialog(msoFileDialogFolderPicker)
.Title = "Choose the folder to be analized"
.Show
If .SelectedItems.Count > 0 Then
gsPath = .SelectedItems(1)
Else
If MsgBox("Folder not selected. Use current path?", _
vbApplicationModal + vbQuestion + vbOKCancel + vbDefaultButton2, _
"Warning") = vbOK Then
gsPath = ThisWorkbook.Path
Else
Exit Sub
End If
End If
End With
If Right$(gsPath, 1) <> Application.PathSeparator Then gsPath = gsPath & Application.PathSeparator
' initialize
With Application
.Calculation = xlCalculationManual
.EnableEvents = False
' .ScreenUpdating = False
End With
' range
Worksheets(gksWorkbooks).Activate
Set grng = Range(gksWorkbooksTable)
With grng
Range(.Rows(2), .Rows(.Rows.Count)).ClearContents
End With
gI = grng.Cells(1, 1).End(xlDown).End(xlDown).End(xlUp).Row
'
' process
' files & folders
Set fso = CreateObject("Scripting.FileSystemObject")
Set fld = fso.getfolder(gsPath)
FolderAnalysisDetail fld
Set fso = Nothing
' sort
With ActiveWorkbook.Worksheets("Workbooks").Sort
.SortFields.Clear
.SortFields.Add Key:=Range("A:A"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
.SortFields.Add Key:=Range("B:B"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
.SetRange Range("A:AD")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("C2").Select
'
' end
Beep
' terminate
With Application
.Calculation = xlCalculationAutomatic
.CalculateFull
.EnableEvents = True
.ScreenUpdating = True
End With
' save
With ThisWorkbook
.Activate
DoEvents
.Save
End With
End Sub

Sub FolderAnalysisDetail(ByRef fld As Object)
'
' constants
'
' declarations
Dim fldSub As Object, fls As Object, fn As Object
Dim dCreation As Date, dModification As Date
Dim iAttribute As Integer
'
' start
'
' process
' files
On Error Resume Next
With grng
gsPath = fld.Path
For Each fn In fld.Files
gsFileName = fn.Name
dCreation = fn.DateCreated
dModification = fn.DateLastModified
' only files
iAttribute = GetAttr(gsPath & Application.PathSeparator & gsFileName)
If gsFileName <> ActiveWorkbook.Name Then ' And _
(iAttribute And vbArchive = vbArchive Or _
iAttribute And vbNormal = vbNormal) Then
' not actual
gI = gI + 1
.Cells(gI, gkiWorkbookgsPath).Value = gsPath
.Cells(gI, gkiWorkbooksFile).Value = gsFileName
.Cells(gI, gkiWorkbooksCreationDate).Value = dCreation
.Cells(gI, gkiWorkbooksModificationDate).Value = dModification
End If
Next fn
End With
On Error GoTo 0
DoEvents
' recurse subfolders
For Each fldSub In fld.SubFolders
FolderAnalysisDetail fldSub
Next fldSub
'
' end
End Sub

-----


2) Name a sheet "Workbooks" and define a named range as "WorkbooksTable" ranging from columns A:E in that sheet (or update code properly if other names used)


3) Run macro FolderAnalysis: two things, output ranges is always cleared, folder recursion is always on


Hope it helps, otherwise just advise. It's a shortened version of the Excel documenting and inspector workbook. Checked and runs Ok.


Regards!


PS: if you want the full file version for Excel, please post an email address and I'll get back to you.
 
Hi Sir J(ames) B(ond) - 007 (of Excel)


Brilliant Solution.. By using this as a help file,

I have crated a macro to arrange all my Music's (*.mp3) files in separate Folder just Like Album Folder..

You made my IPOD live.. and my life more Musical..

I would love to share it with you when I will complete it,

so that It can arrange by Author,MusicDirector, or by any TAG found in the *.mp3 file.. and arrange the same in folder wise..

I am currently stuck in Scripting.FileSystemObject > Name Function .. to rename the file sometime according to FileName, and sometime according to Folder Name..


confirming again...I have not made any mistake by choosing you as My Idol..
 
@Debraj Roy


Hi!


I - About what you should be using..


Being addict to WinAmp and iTunes, I used to think that it was a heavy duty arranging all mp3 files... until I found mp3Tag. My libraries were only then as I always wanted them to be.

Here it is:

http://www.mp3tag.de/en/

I'm sure you'll find it more than useful. Wanna bet?


II - About what you're intending to use...


I strongly recommend you download the full version of my first comment (3rd) in this topic, as it has a user form, originally intended to "view code"... but why not changing it to "view tags"?

Just advise if any help needed.


Regards!
 
Back
Top