Public Sub
a0_Insert_Photos_by_Selection()
'-----------------<
a0_Insert_Photos_by_Selection() >-----------------
'--< Import-Dialog >--
Dim objFiledialog As FileDialog
Set objFiledialog =
Application.FileDialog(msoFileDialogFilePicker)
objFiledialog.AllowMultiSelect = True
objFiledialog.ButtonName = "Import Images"
objFiledialog.Filters.Add "Images Photos", "*.jpg"
objFiledialog.Title = "Select the photos.."
If Not objFiledialog.Show() = True Then
Exit Sub
End If
'--<
Import-Dialog >--
'--< Kontrolle >--
'</ Ordner ist leer >
If objFiledialog.SelectedItems().Count = 0 Then
Exit Sub
End If
'</ Ordner
ist leer >
Selection.TypeParagraph
On Error Resume Next
'-------<
@Loop: Insert all Images >--------
Dim objInlineShape As
InlineShape
Dim sFilename As String
Dim iFile As Integer
Dim iMax As Integer
iMax = objFiledialog.SelectedItems.Count
For iFile = 1 To
iMax Step 1
'------<
Loop.Item >------
DoEvents
'<
get selection >
sFilename =
objFiledialog.SelectedItems(iFile)
'</
get selection >
'----<
Insert Image >----
'<
insert picture from Link >
Set objInlineShape =
ActiveDocument.InlineShapes.AddPicture(FileName:=sFilename, LinkToFile:=False, SaveWithDocument:=True)
'</
insert picture from Link >
'--<
replace as png >--
'*reduce
memory 1 MB to 1kb
'<
cut >
objInlineShape.Select
Selection.Cut
'</
cut >
'*pasteBitmap
is much smaller
Selection.PasteSpecial Link:=False, DataType:=wdPasteBitmap,
Placement:=wdInLine, DisplayAsIcon:=False
'--</
replace as png >--
'<
add spacer >
Selection.TypeParagraph
Selection.TypeText Text:=" "
'</
add spacer >
If Err.Number <> 0 Then
MsgBox Err.Description
Err.Clear
End If
'----</
Insert Image >----
'------</
Loop.Item >------
Next
'-------</ @Loop: Insert all Images
>--------
'-------< @Loop: create all JPG Thumbnails >--------
'*create png
Bitmaps and jpg thumbnails when saved as website
For Each objInlineShape In ActiveDocument.InlineShapes
objInlineShape.Line.Style =
msoLineSingle
objInlineShape.Line.Weight = 1
Next
'-------</
@Loop: create all JPG Thumbnails
>--------
'-----------------</
a0_Insert_Photos_by_Selection() >-----------------
End Sub
|