#1
|
|||
|
|||
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 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. |
#2
|
||||
|
||||
Delete:
.Width = 363.6 and change: .Height = 272.9 to: .Height = InchesToPoints(0.7)
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Fast and nice. You are one of the best VBA guys of all time.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Inserting a Border Around a Picture in a Frame | Colonel Biggs | Drawing and Graphics | 0 | 03-11-2019 02:45 PM |
Inserting more than one picture in a time | eefibau | PowerPoint | 1 | 01-24-2019 10:19 AM |
after inserting picture | goldeneye11 | Drawing and Graphics | 2 | 12-31-2018 08:29 PM |
Inserting picture problem | NewestUser | PowerPoint | 0 | 11-25-2012 10:42 AM |
Inserting Picture | blumburg | PowerPoint | 0 | 04-27-2011 08:05 PM |