Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-28-2019, 02:47 PM
BLUEPUPIL BLUEPUPIL is offline Inserting and formatting a picture Windows 7 64bit Inserting and formatting a picture Office 2016
Novice
Inserting and formatting a picture
 
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
  #2  
Old 04-28-2019, 02:54 PM
macropod's Avatar
macropod macropod is offline Inserting and formatting a picture Windows 7 64bit Inserting and formatting a picture Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Delete:
.Width = 363.6
and change:
.Height = 272.9
to:
.Height = InchesToPoints(0.7)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 04-28-2019, 03:14 PM
BLUEPUPIL BLUEPUPIL is offline Inserting and formatting a picture Windows 7 64bit Inserting and formatting a picture Office 2016
Novice
Inserting and formatting a picture
 
Join Date: Feb 2016
Posts: 20
BLUEPUPIL is on a distinguished road
Default

Fast and nice. You are one of the best VBA guys of all time.
Reply With Quote
Reply



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
Inserting and formatting a picture 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

Other Forums: Access Forums

All times are GMT -7. The time now is 09:12 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft