Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
Naturesk
Femeie
25 ani
Bucuresti
cauta Barbat
25 - 47 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [POWERPOINT] Create Custom Buttons to Color Selected Text [VBA] Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 739
Create a new PowerPoint presentation, open VBA (ALT + F11), add new module and enter the following codes. Save as PowerPoint macro enabled document.

Code is:


Sub ColorTxtGreen(control As IRibbonControl)
    With ActiveWindow.Selection
        If .Type = ppSelectionText Then
            .TextRange.Font.Color.RGB = RGB(0, 255, 0) 'green
        End If
    End With
End Sub

Sub ColorTxtRed(control As IRibbonControl)
    With ActiveWindow.Selection
        If .Type = ppSelectionText Then
            .TextRange.Font.Color.RGB = RGB(255, 0, 0) 'red
        End If
    End With
End Sub

Sub ColorTxtBlue(control As IRibbonControl)
    With ActiveWindow.Selection
        If .Type = ppSelectionText Then
            .TextRange.Font.Color.RGB = RGB(0, 0, 255) 'blue
        End If
    End With
End Sub

Sub ColorTxtBlack(control As IRibbonControl)
    With ActiveWindow.Selection
        If .Type = ppSelectionText Then
            .TextRange.Font.Color.RGB = RGB(0, 0, 0) 'black
        End If
    End With
End Sub

Sub ColorTxtWhite(control As IRibbonControl)
    With ActiveWindow.Selection
        If .Type = ppSelectionText Then
            .TextRange.Font.Color.RGB = RGB(255, 255, 255) 'blue
        End If
    End With
End Sub


You will have to edit the pptm file with Custom UI Editor for Microsoft Office, in order to be able to add custom buttons to the add-in's ribbon. Note the image attribute is referring to icons uploaded to the pptm file via Custom UI Editor.

Example:



<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="customTab" label="TRAP">

  <group id="customGroup1" label="Color text">

    <button id="customButton1" label="Red" image="TextRed2" size="large" onAction="ColorTxtRed" />
    <button id="customButton2" label="Green" image="TextGreen2" size="large" onAction="ColorTxtGreen" />
    <button id="customButton3" label="Blue" image="TextBlue2" size="large" onAction="ColorTxtBlue" />
    <button id="customButton4" label="Black" image="TextBlack2" size="large" onAction="ColorTxtBlack" />
    <button id="customButton5" label="White" image="TextWhite2" size="large" onAction="ColorTxtWhite" />

  </group>

</tab>
</tabs>
</ribbon>
</customUI>


pus acum 3 ani
   
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 739
You can add these buttons to QAT for even easier access (rather than having to select the toolbar). By going to Customize QAT, selecting All Commands and looking for button names.

My colors on the ribbon are named: Red, Green, Blue, Black, White.

So in the All Commands list I look for those names.


pus acum 3 ani
   
Pagini: 1  

Mergi la