Results 1 to 9 of 9

Thread: Problem using "controls" command

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,888
    Location
    OK, I'm GUESSING that you're trying to make some sort of scoreboard using PowerPoint in presentation mode

    You never said how you plan to trigger events, so I'm going with the way I do it. Maybe it'll give you ideas. Ask questions if you want

    I think you thought the 'Shapes' on the slide were 'Controls' - something different

    Sub Init() is required to start - click on it's shape on the slide.

    It also has the answer to your original question

    There are other ways to automatically run Init, but they require CustomUI. Not hard but can be tricky

    Sub ShapeSub() responds to clicks. Use Insert, Action, Run Macro


    Option Explicit
    
    
    Sub Init()
        Dim i As Long
        
        For i = 1 To ActivePresentation.Slides(1).Shapes.Count
            With ActivePresentation.Slides(1).Shapes(i)
                If .Name Like "o_*" Then                   '   or             If .Name = "o_" & i Then
                    .TextFrame.TextRange.Text = 100
                End If
            End With
        Next i
    End Sub
    
    
    
    
    Sub ShapeSub(oShape As Shape)
        oShape.TextFrame.TextRange.Text = oShape.TextFrame.TextRange.Text - 1
    End Sub
    Capture.JPG
    Attached Files Attached Files
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •