none
How to set Stretch Option in VBA RRS feed

  • Question

  • hi

    I added a shape and set background use a picture,now i want to set the stretch options,and no tile.

    there is  some bug in 2007 I think,for example: if I set tile picture as texture,scale x&y should be 0.8=80%,but some picture i need to set scale 0.008.

    so i can only set stretch option to make sure the picture display no problem.

    so how to set stretch option in vba?

    thanks for your help.

    Sunday, September 28, 2014 3:36 AM

Answers

  • Hi,

    Have you see the article below which is introducing how to work with the FillFormat class' texture settings in Microsoft PowerPoint 2010. I think it is suit for PowerPoint 2007.

    Applying Texture Settings to Shapes in Office 2010.

    In this article, I find that we can use FillFormat.TextureTile Property to set whether the texture fill is tiled or centered.

    But I fail to find how to set the Left, Right, Top and Bottom Offsets for Stretch options. I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, September 29, 2014 8:46 AM
    Moderator
  • Hi,

    I would like to let you know that PowerPoint Object model doesn't allow to set these options through VBA code.

    You can still set "Tile picture as texture" option and its related options like Offset X, Offset Y etc. through VBA code.

    Thanks,

    Anush.

    Wednesday, October 22, 2014 7:57 PM

All replies

  • For what Office application are you writing this?

    Kind Regards, Rich ... http://greatcirclelearning.com

    Sunday, September 28, 2014 2:19 PM
  • VBA,insert a photo to chart
    Monday, September 29, 2014 4:07 AM
  • Hi,

    Have you see the article below which is introducing how to work with the FillFormat class' texture settings in Microsoft PowerPoint 2010. I think it is suit for PowerPoint 2007.

    Applying Texture Settings to Shapes in Office 2010.

    In this article, I find that we can use FillFormat.TextureTile Property to set whether the texture fill is tiled or centered.

    But I fail to find how to set the Left, Right, Top and Bottom Offsets for Stretch options. I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, September 29, 2014 8:46 AM
    Moderator
  • Hi,

    I would like to let you know that PowerPoint Object model doesn't allow to set these options through VBA code.

    You can still set "Tile picture as texture" option and its related options like Offset X, Offset Y etc. through VBA code.

    Thanks,

    Anush.

    Wednesday, October 22, 2014 7:57 PM
  • Can these options be set through the Microsoft.Office.Interop.PowerPoint extension via VB.net?  When I attempt to access the PictureEffects collection for the FillFormat of a shape I get an error

    "This member can only be accessed for a picture or an OLE object." 

    I have a cell in a table that has an image embedded.  The only way I can see to change the stretch settings, other than through the UI, is to access the Fill.PictureEffects for the cell shape and then the PictureEffects.EffectParameters for each PictureEffect.  The example in the VBA reference does not work because of the same error being returned.  Is there a way to access the embedded image of the shape?  Maybe that is the way to do it. 

    The Office 2013 PowerPoint VBA Reference described the PictureEffect property as:

    PictureEffect

    Returns an object that represents the picture or texture fill for the specified fill format. Read-only.

    The PictureEffects property returns a PictureEffects collection that corresponds to the settings associated with the Picture or texture fill option in the Fill category

    If you try to run the example in the VBA reference you get the same error

    Sub PictureEffectSample()
    ' Setup a slide with one picture shape.
    With ActivePresentation.Slides(1).Shapes(1).Fill.PictureEffects
     
     ' Insert a 150% Saturation effect.
     .Insert(msoEffectSaturation).EffectParameters(1).Value = 1.5
     
     ' Insert Brightness/Contrast effect and set values to -50% Brightness and +25% Contrast.
     Dim brightnessContrast As PictureEffect

    '***Receive the error at this point

     Set brightnessContrast = .Insert(msoEffectBrightnessContrast)
     brightnessContrast.EffectParameters(1).Value = -0.5
     brightnessContrast.EffectParameters(2).Value = 0.25
     
     ' Remove all Picture effects. *** Also cannot get a .Count to return, get same error
     While .Count > 0
     .Delete (1)
     Wend
     
    End With
    End Sub

    If there is sample code you would think it would work.  If these settings can be set through the UI there should be a way to set it through VBA or VB.net.  Any help with this would be greatly appreciated. 

    Thanks,

    Cammy

    Friday, August 28, 2015 10:07 PM
  • Hi Cammy,

    I'm confused... it's easy at my age. :-)

    Are you trying to change a scaled dimension (aka resize) on an image or are you trying to add some other layered special effect? Changing dimensions of an image are not a "fill" effect and that is why I am asking.

    I can help with resizing but if you are looking for help with "special effects"... I'll leave it to others. :-)


    Kind Regards, Rich ... http://greatcirclelearning.com

    Friday, August 28, 2015 10:47 PM
  • Charts("Chart1").SeriesCollection(1).PictureType = xlStretch
    Tuesday, October 29, 2019 7:54 AM