Hi Paul...
I read you kind of mad... if so I sorry... I didnt name the problem because it apears in spanish I dont know how to translate it.
About your macros posted aboved I work with it trying to solve the problem. And Actually I did fix it.
But still is not MY BEST way because I dont want the images in a Table, as I posted above.
Also I tried to modified and insert more lines in the table for the extra strings I need. And it only works if I choose 1 image... if I select more it does what it should as you programm it.
as I told before this real hard for me, but Im not quitting.
Sub AddPics() Application.ScreenUpdating = False
Dim oTbl As Table, i As Long, j As Long, StrTxt As String
'Select and insert the Pics
With Application.FileDialog(msoFileDialogFilePicker)
.Title = "Select image files and click OK"
.Filters.add "Images", "*.gif; *.jpg; *.jpeg; *.bmp; *.tif; *.png"
.FilterIndex = 2
If .Show = -1 Then
'Add a 4-row by 1-column table with 15cm column width to take the images
Set oTbl = Selection.Tables.add(Selection.Range, 4, 1)
With oTbl
.AutoFitBehavior (wdAutoFitFixed)
.Columns.Width = CentimetersToPoints(15)
'Format the rows
Call FormatRows(oTbl, 1)
End With
CaptionLabels.add Name:="Figura"
For i = 1 To .SelectedItems.Count
j = i * 2 - 1
'Add extra rows as needed
If j > oTbl.Rows.Count Then
oTbl.Rows.add
oTbl.Rows.add
Call FormatRows(oTbl, j)
End If
'Insert the Picture
ActiveDocument.InlineShapes.AddPicture _
FileName:=.SelectedItems(i), LinkToFile:=False, _
SaveWithDocument:=True, Range:=oTbl.Rows(j).Cells(1).Range
'Get the Image name for the Caption
StrTxt = Split(.SelectedItems(i), "\")(UBound(Split(.SelectedItems(i), "\")))
StrTxt = ": " & Split(StrTxt, ".")(0)
'Insert the Caption on the row below the picture
With oTbl.Rows(j + 1).Cells(1).Range
.InsertBefore vbCr
.Characters.First.InsertCaption _
Label:="Figura", Title:=StrTxt, _
Position:=wdCaptionPositionBelow, ExcludeLabel:=False
.Characters.First = vbNullString
.Characters.Last.Previous = vbNullString
End With
Next
Else
End If
End With
Application.ScreenUpdating = True
End Sub
'
Sub FormatRows(oTbl As Table, x As Long)
With oTbl
With .Rows(x)
.Height = CentimetersToPoints(10)
.HeightRule = wdRowHeightExactly
.Range.Style = "Normal"
End With
With .Rows(x + 1)
.Height = CentimetersToPoints(0.75)
.HeightRule = wdRowHeightExactly
.Range.Style = "Normal"
End With
End With
End Sub
Also I took your code and others found in other websites how to insert images, trying to solve my problem and do it without a table and keep the part of telling the name of the image and the number.... but I havent make it work yet. Probably because i dont know the commands well. and how to name what I want.
Just came my boss to speak to me and told yeld it me because I havent got this this thing working yet... actually is frustraing to demand things from people there are not capable of... (sorry I know this paragrahs is not accurate to the theme) but im need to share it some how, because he left me crying.
Paul... I really hope you can helpme