Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-24-2023, 01:39 PM
workmacpc workmacpc is offline Creating a VBA code to crop a photo Windows XP Creating a VBA code to crop a photo Office 2021
Novice
Creating a VBA code to crop a photo
 
Join Date: Jul 2023
Posts: 1
workmacpc is on a distinguished road
Default Creating a VBA code to crop a photo


Hi I'm trying to create a VBA code, that crops a photo to a shape, however whichever way i do it I cant seem to get the code to work.
Can anyone help me? I'm trying to crop the photos to a circle and then add a line colour.

Thanks in advance for any help!
Reply With Quote
  #2  
Old 07-31-2023, 03:26 AM
JohnWilson JohnWilson is offline Creating a VBA code to crop a photo Windows 10 Creating a VBA code to crop a photo Office 2019
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,912
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

Basic code is
Code:
Sub croptoshape()
Dim shp As Shape
    Set shp = ActiveWindow.Selection.ShapeRange(1)
    If shp.Type = msoLinkedPicture Or shp.Type = msoPicture Then
        shp.AutoShapeType = msoShapeOval
        shp.Line.Weight = 10
        shp.Line.ForeColor.RGB = RGB(120, 120, 120)
    End If
End Sub
Note this will crop to an OVAL unless the original pic is square
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a VBA code to crop a photo creating HTML code for email trevorc Excel Programming 6 05-17-2021 09:29 PM
Creating a VBA code to crop a photo Need help creating vba code Moot70 Excel Programming 18 11-03-2019 01:17 AM
Creating a QR code in microsoft word? ayupchap Word 1 08-20-2019 02:30 PM
Creating a VBA code to crop a photo Code to creating a custom TOC including too many styles amer1749 Word VBA 4 07-03-2016 10:42 AM
Creating a VBA code to crop a photo Help Creating Macro to Crop/Resize Images ineedmacrohelp Word VBA 1 08-06-2015 06:46 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:44 PM.


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