Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-05-2023, 10:41 PM
laith93 laith93 is offline Make shapes autofit to slide width Windows 10 Make shapes autofit to slide width Office 2019
Competent Performer
Make shapes autofit to slide width
 
Join Date: Jul 2021
Posts: 117
laith93 is on a distinguished road
Default Make shapes autofit to slide width

Hi,


With this code, you can autofit shapes to fit slide width, but it requires to put your dimension (Left, width), which may be not suitable when changing your slide size, it will require setting a new dimension
So how to make shapes autofit slide width without setting the dimension each time?
Thanks

Code:
Sub TextBoxAutoFitWidth4All()

  'set the variables
  Set pst = ActivePresentation
  
  'start the loops
  For Each osld In pst.Slides
    For Each oshp In osld.Shapes
      pass = 1
      'check if we want to skip the shape
      If oshp.HasTextFrame = msoFalse Then pass = 0
      'we can add as many as we want here in case there is more criteria needed
      If pass = 1 Then
        With oshp
          .LockAspectRatio = False
          .Left = 15
          .Width = 900

        End With
      End If
    Next oshp
  Next osld
End Sub
Reply With Quote
  #2  
Old 12-05-2023, 11:37 PM
laith93 laith93 is offline Make shapes autofit to slide width Windows 10 Make shapes autofit to slide width Office 2019
Competent Performer
Make shapes autofit to slide width
 
Join Date: Jul 2021
Posts: 117
laith93 is on a distinguished road
Default

I am sorry
I solved the problem by using
Code:
.Width = ActivePresentation.PageSetup.SlideWidth
Thanks
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make custom shapes??? gkeddie Drawing and Graphics 0 07-30-2017 07:28 PM
Set tables in email to default to "AutoFit Column Width"? viper92283 Outlook 0 02-26-2014 03:31 PM
Is there a way to make a table in a header match the width of the page always? trueimage Word 1 10-03-2013 06:13 PM
All Shapes on slide excelledsoftware PowerPoint 9 09-15-2013 04:03 AM
Make shapes autofit to slide width How to make the Caption and its text have the same width as the table? Jamal NUMAN Word 1 04-24-2011 06:44 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:11 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