VBA Macro Powerpoint for formatting selected text

Answered VBA Macro Powerpoint for formatting selected text

  • viernes, 11 de mayo de 2012 23:04
     
     

    My objective is to be able to format selected text regardless of whether it is in a textbox or table

    I currently have the following code, this works fine in changing the font and inserting bullet points, but I cannot seem to indent the bullet points. 

    Although not shown below, i have tried various code snippets using, indentlevel and ruler etc, however, all seem to generate an error i.e. textframe not part of.....

    I think this is a simple code, but I am can not seem to figure this out, can anyone provide a code snippet, that will allow me to bullet point and indent any selected text, regardless of the container its in i.e. textbox, or table. Thanks

    Sub setTextDetails()
     With ActiveWindow.Selection.TextRange.Font
    .Name = "Arial"
    .Size = 9
    .Bold = msoFalse
    .Italic = msoFalse
    .Underline = msoFalse
    .Shadow = msoFalse
    .Emboss = msoFalse
    .BaselineOffset = 0.3
    .AutoRotateNumbers = msoFalse
    .Color.SchemeColor = ppForeground

      With ActiveWindow.Selection.TextRange
                .Paragraphs.ParagraphFormat.Alignment = ppAlignLeft
                .Paragraphs.ParagraphFormat.Bullet.Type = ppBulletUnnumbered
                .Paragraphs.ParagraphFormat.Bullet.Visible = msoTrue
                
    End With
    End With        
    End Sub

Todas las respuestas

  • sábado, 12 de mayo de 2012 15:56
     
     Respondida

    This should work, where x is the indentlevel value (1,2,..)

    Activewindow.Selection.TextRange.IndentLevel = x


    Regards, Shyam (http://skp.mvps.org)