This VBA code imports JPEG photos from a specified folder into an InDesign document. It uses a directory function to build an array of all JPEG file names in the folder. It then loops through each page in the document, imports the corresponding photo from the file array, and sets the bounding box size and location for each imported photo shape. The end result is a multi-page InDesign document with photos from the source folder automatically placed and sized on each page.
This VBA code imports JPEG photos from a specified folder into an InDesign document. It uses a directory function to build an array of all JPEG file names in the folder. It then loops through each page in the document, imports the corresponding photo from the file array, and sets the bounding box size and location for each imported photo shape. The end result is a multi-page InDesign document with photos from the source folder automatically placed and sized on each page.
This VBA code imports JPEG photos from a specified folder into an InDesign document. It uses a directory function to build an array of all JPEG file names in the folder. It then loops through each page in the document, imports the corresponding photo from the file array, and sets the bounding box size and location for each imported photo shape. The end result is a multi-page InDesign document with photos from the source folder automatically placed and sized on each page.
" ........\" Dim pg As Page Set doc = ActiveDocument bFirst = True strFile = Dir(ImportFolder & "*.jpg") Dim i As Integer Dim j As Integer i = 0 Dim barArray() As String ReDim Preserve barArray(100) 'nos photos no. Dim txt As TextRange Dim phFile As String While strFile <> "" barArray(i) = strFile strFile = Dir() i = i + 1 Wend k = 1 For j = 0 To i - 1 Set pg = doc.Pages(k) pg.ActiveLayer.Import ImportFolder & barArray(j) For x = 1 To pg.Shapes.Count If pg.ActiveLayer.Shapes(x).Selected Then pg.ActiveLayer.Shapes(x).SetBoundingBox 2.500, 1.500, 1.3, 1.8 ' First two digit for location and sencod two digits for size width and height End If Next x k = k + 1 Next j End Sub