Share via

POWERPOINT MACROS - Format selected text

Anonymous
2016-12-19T19:42:42+00:00

I want to format a selected text in a Textbox, so I came up with the folowing code:

Application.ActiveWindow.Selection.ShapeRange(TextBox2.Text).TextFrame.TextRange.Font.Bold = msoTrue

The problem is that it says that there is no currently active window. I know more or less why, but I don't know how I can fix this problem. Will be very happy if someone could help me!

Microsoft 365 and Office | PowerPoint | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Anonymous
    2016-12-20T20:17:14+00:00

    I want ONLY to apply the bold to the selected text.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2016-12-20T19:17:26+00:00

    I think you've already posted in stack trace where I replied. You can select text in slide show only if it is a activex control. If you are using a text control then you can bold all of the text and not a selection. To be able to bold only specific blocks of text make use of the RichTextBox control.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2016-12-20T08:22:41+00:00

    Are you trying to format selected text in an ActivX textbox in slide show mode? (This is the only way I can see there being no ActiveWindow)

    I don't think you will be able to do this. 

    If that's what you are trying to do this will bold all the text but not just selected text in an ActivX textbox named TextBox2

    Sub BoldMe()

    Dim osld As Slide

    Set osld = SlideShowWindows(1).View.Slide

    osld.Shapes("TextBox2").OLEFormat.Object.Font.Bold = True

    End Sub

    Was this answer helpful?

    0 comments No comments
  4. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more