none
change font color in PowerPoint at the current position RRS feed

  • Question

  • Hallo,
    i need to change the font color at the current position in PowerPoint.
    1. The following code works only, when i select (mark) a textpart:
    papp.ActiveWindow.Selection.TextRange.Font.Color.RGB = RGB(95,95,95)
    
    2. The following code change the color of all text in the current textbox:
    papp.ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Font.Color.RGB = RGB(95,95,95)
    
    3. In MS Word 2010 the following code is working as needed:
    wapp.Selection.Font.TextColor.RGB = RGB(95,95,95)
    
    Can anyone help, how i can change the font color in PowerPoint at the current position?
     
    Thanks,
    Andreas
    Wednesday, January 11, 2012 4:08 PM

Answers

  • You need to provide a reference to the Windows Forms namespace.

    Imports Forms = System.Windows.Forms
    

    Then you can type:

    Forms.SendKeys.Send("{BS}")


     


    Kind Regards, Rich ... http://greatcirclelearning.com

    Thursday, January 12, 2012 2:03 PM

All replies

  • What I've found that works is to insert a character and then delete it this way.

        Set tRng = PowerPoint.ActiveWindow.Selection.TextRange
        tRng.Text = " "
        tRng.Font.Color.RGB = RGB(95, 95, 95)
        SendKeys "{BS}"
    
    

     


    Kind Regards, Rich ... http://greatcirclelearning.com
    Wednesday, January 11, 2012 7:28 PM
  • Hallo Rich,

    thanks for your replay. The first part (set text and font color) works great. But i havn't found the SendKeys function. I'm writing a Add-in for PowerPoint 2010 and there is no SendKey function available ("Microsoft.Office.Interop.PowerPoint"). Any Idea?

    Regards Andreas


    Thursday, January 12, 2012 1:39 PM
  • You need to provide a reference to the Windows Forms namespace.

    Imports Forms = System.Windows.Forms
    

    Then you can type:

    Forms.SendKeys.Send("{BS}")


     


    Kind Regards, Rich ... http://greatcirclelearning.com

    Thursday, January 12, 2012 2:03 PM
  • Works great.

    Thanks again.

    Thursday, January 12, 2012 6:56 PM