none
PowerPoint VBA - manipulate contents of textframes RRS feed

  • Question

  • I'm trying to have a macro in powerpoint vba to extract a portion of text from an existing textframe (as part of a bigger macro), the issue is right now i can't seem to isolate out a specific part of it. I managed to get the text into a string variable, but from there on i have no idea how to pick it apart, the text itself follows a specific format:

    aaaa bbb (cc-dd), xxxx yyyy, 1234

    i only want to isolate out xxxx yyyy, how can i do that? (using powerpoint 2010)

    thank you!!



    Wednesday, March 13, 2013 8:35 PM

Answers

  • Hi Sapphire8852, 

    If the format of the text is unchanged, we can try the following code:

    Sub ExtractText()
    Dim s As String
    s = "aaaa bbb (cc-dd), xxxx yyyy, 1234"
    Dim sResult As String
    sResult = Right(s, Len(s) - Len("aaaa bbb (cc-dd),"))
    sResult = Left(sResult, Len(sResult) - Len(", 1234"))
    
    Debug.Print sResult
    
    End Sub
    

    Good day.


    Yoyo Jiang[MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, March 15, 2013 9:34 AM
    Moderator

All replies