English 中文(简体)
How to increase the size of a shape nudge with each new slide in PowerPoint VBA?
原标题:

This code creates a string of 10 slides, in which each next slide s 2 shapes (number 1 and number 3) are nudged a bit in relation to similar shapes in the previous slide, while one shape (number 2) remains in the same position throughout.

Each nudge is equal to 2 points (pixels?), but I wonder how could I modify this code so that each nudge would be greater than the previous one by one point. For example, the nudge for creating slide 2 would be 2 points, but the nudge for slide 3 will be 3 points, etc.

Sub MovingFlanks()
    Dim oPresentation As Presentation
    Set oPresentation = ActivePresentation
    Dim oSlide As Slide 
    Dim oSlides As SlideRange
    Dim oShape As Shape
    Dim slideNumber As Integer
    For slideNumber = 1 To 10
        Set oSlide = oPresentation.Slides(oPresentation.Slides.Count)
        oSlide.Copy
        Set oNewSlides = oPresentation.Slides.Paste()
        Set oSlide = oNewSlides(1)
        Set oShape = oSlide.Shapes(1)   
        For Each shapeNum In Array(1, 3)
            Set oShape = oSlide.Shapes(shapeNum)
            oShape.Left = oShape.Left + 2 
        Next shapeNum
    Next slideNumber
End Sub
最佳回答

Just replace:

oShape.Left = oShape.Left + 2

...with:

oShape.Left = oShape.Left + slideNumber

(although you might want to use slideNumber * 10 to make it noticeable).

问题回答

暂无回答




相关问题
Handling no results for docmd.applyfilter

I have an Access app where I use search functionality. I have a TextBox and a Search Button on the form, and it does a wildcard search of whatever the user enters in the TextBox, and displays the ...

Outlook 2007 CommandBarControl.Execute won t work

I recently switched to Outlook 2007 and noticed that my VBA-macros won t work. I use the following code to open a new appointment-item (and fill it automatically). It worked perfect in Outlook 2003, ...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

MS Access: list macro from VBA

I have to deal with a few macros (not VBA) in an inherited Access application. In order to document them, I would like to print or list the actions in those macros, but I am very dissatisfied by ...

热门标签