View Single Post
 
Old 04-28-2019, 02:47 PM
BLUEPUPIL BLUEPUPIL is offline Windows 7 64bit Office 2016
Novice
 
Join Date: Feb 2016
Posts: 20
BLUEPUPIL is on a distinguished road
Default Inserting and formatting a picture

I've got this macro:

HTML Code:
Sub InsertFormatedPicture()
'
' InsertPicture Macro
'
Dim fileSelected As Variant
Dim fileOpenDialog As FileDialog
Dim newPicture As InlineShape

Set fileOpenDialog = Application.FileDialog(msoFileDialogOpen)

Selection.Delete
'Unit:=wdCharacter, Count:=1
With fileOpenDialog
.AllowMultiSelect = False
.Filters.Add "Images", "*.gif; *.jpg; *.jpeg", 1
If .Show = -1 Then
fileSelected = .SelectedItems(1)
Else
Exit Sub
End If
End With
Set newPicture = Selection.InlineShapes.AddPicture(FileName:=fileSelected, LinkToFile:=False, SaveWithDocument:=True)
With newPicture
.LockAspectRatio = msoTrue
.Height = 272.9
.Width = 363.6
With .Borders(wdBorderLeft)
.LineStyle = wdLineStyleThinThickSmallGap
.LineWidth = wdLineWidth150pt
.Color = wdColorRed
End With
With .Borders(wdBorderRight)
.LineStyle = wdLineStyleThickThinSmallGap
.LineWidth = wdLineWidth150pt
.Color = wdColorRed
End With
With .Borders(wdBorderTop)
.LineStyle = wdLineStyleThinThickSmallGap
.LineWidth = wdLineWidth150pt
.Color = wdColorRed
End With
With .Borders(wdBorderBottom)
.LineStyle = wdLineStyleThickThinSmallGap
.LineWidth = wdLineWidth150pt
.Color = wdColorRed
End With
.Borders.Shadow = False
End With
End Sub
The author is caddcop and the macro works well.
I want to make a single modification concerning the size of the picture.
Size: Height=Absolute-0.7"; Lock aspect ratio; Width=not specified, because its result of (derived from) the Height and Locked aspect ratio.
Thanks in advance for any assistance you can provide.
Reply With Quote