![]() |
#1
|
|||
|
|||
![]()
Dear friends,
I create a word macro to insert, crop and resize image. But it duplicate the inserted image, one orginal size and one resized. How to solve this? Thanks. Here is the code Private Sub CommandButton1_Click() Dim Photo As InlineShape Dim sngHeight, sngWidth, sngCrop As Single Dim strPicName As String strPicName = "" With Application.Dialogs(wdDialogInsertPicture) If .Show = -1 Then strPicName = .Name End With Set Photo = ActiveDocument.InlineShapes.AddPicture(FileName:=s trPicName, _ LinkToFile:=False, SaveWithDocument:=True) With Photo sngHeight = .Height sngWidth = .Width With .PictureFormat .CropLeft = sngWidth * 0.175 .CropRight = sngWidth * 0.12 '.CropTop = sngHeight * sngCrop '.CropBottom = sngHeight * sngCrop End With '.Height = .Height * 1 / (1 - sngCrop * 2) '.Width = .Width * 1 / (1 - sngCrop * 2) .LockAspectRatio = msoCTrue .Width = .Width - (CropRight + CropLeft) .Width = InchesToPoints(1.5) End With End Sub |
#2
|
|||
|
|||
![]()
This is because your code inserts the picture twice. Try:
Code:
With Application.Dialogs(wdDialogInsertPicture) If .Display = -1 Then If .Name <> "" Then Set Photo = ActiveDocument.InlineShapes.AddPicture(FileName:=.Name, _ LinkToFile:=False, SaveWithDocument:=True, _ Range:=Selection.Range) End If End If End With |
#3
|
|||
|
|||
![]() Quote:
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Shortcut for image resize | Hatthans | PowerPoint | 0 | 01-06-2014 04:32 PM |
How to resize the image in the header so that it fits the page | Isadora | Excel | 1 | 08-20-2013 06:02 AM |
Image proportional resize not functioning! | alexfcm | PowerPoint | 0 | 09-27-2012 07:22 AM |
Background image vs. insert image | lilaria | PowerPoint | 0 | 04-18-2011 08:45 AM |
![]() |
icu222much | Office | 2 | 11-07-2009 02:49 PM |