How to change text colour when text box clicked in Macro enabled Powerpoint 2013? - vba

So I would like the text to change colour from grey to black... How do I do this on Powerpoint 2013 and where would I apply the code? Sorry in advance for not supplying any code I just don't know where to start.

I figured it out myself...
NOTE: You have to set the ForeColor to a certain color before you begin the Slideshow Presentation.
This example shows how to change the preset color to black
Private Sub TextBox1_GotFocus()
TextBox1.ForeColor = RGB(0, 0, 0)
End Sub
.

Related

How to use powerpoint vba, Dock the Selection Panel on the right and The following TaskPanes are on the left, and are expanded - Fill, Size, Picture

The environment I use is office365
How to use powerpoint vba,
Like the picture below
Dock the Selection Panel on the right and The following TaskPanes are on the left, and are expanded :
Fill and Line
Size and Position
Picture Corrections Crop
I refer to the results here
because what I want is something like this.
Dock TaskPanes right using VBA for Word 07?
I have tested the code for this answer.
It works fine and is great!
' Opens the Formatting task pane (Style window)
Application.TaskPanes(wdTaskPaneFormatting).Visible = True
' Docks the Formatting pane on the right
Application.CommandBars("Styles").Position = msoBarRight
But I found that powerpoint seems to Not like word,
Application.TaskPanes(wdTaskPaneFormatting).Visible = True
there is this attribute can call.
in Powerpoint options
You can find it here
Item name
Fill and Line
Size and Position
Picture Corrections Crop
I have tried
The following code works
ActiveWindow.Activate
If Not CommandBars.GetPressedMso("SelectionPane") Then CommandBars.ExecuteMso ("SelectionPane")
'Show the Selection Panel on the right
The following code does not work
After I ran it,
I got the following result.
ActiveWindow.Activate
If Not CommandBars.GetPressedMso("ObjectSizeAndPositionDialog") Then CommandBars.ExecuteMso ("ObjectSizeAndPositionDialog")
'Size and Position panel
If Not CommandBars.GetPressedMso("PictureCorrectionsDialog") Then CommandBars.ExecuteMso ("PictureCorrectionsDialog")
'Picture Corrections Crop panel
'I want to activate these panels -
'Fill and Line
'Size and Position,
'Picture Corrections Crop
'I don't know how to make it go to the left and expand
'I don't know Fill and Line panel its ExecuteMso id
'I know Size and Position panel its ExecuteMso id is - ObjectSizeAndPositionDialog
'I know Picture Corrections Crop panel its ExecuteMso id is - PictureCorrectionsDialog
Fill and Line
Size and Position
Picture Corrections Crop
CommandBars.ExecuteMso ("ObjectSizeAndPositionDialog")
'not work
I found that
this code is wrong.
because I didn't select the object.
so You can first select it with the mouse.
Or do what I did
and use the program to select 1 thing
ActiveWindow.View.Slide _
.Shapes.Placeholders.Item(3).TextFrame.TextRange.Select
Fill and Line
Sub openPaneSltFill()
ActiveWindow.Activate
If Not CommandBars.GetPressedMso("SelectionPane") Then CommandBars.ExecuteMso ("SelectionPane") 'y
'Application.CommandBars.ExecuteMso ("SelectionPane") 'y but little problem
ActiveWindow.View.Slide _
.Shapes.Placeholders.Item(3).TextFrame.TextRange.Select 'need select obj or will bug
Application.CommandBars.ExecuteMso ("MoreLines2")
'Application.CommandBars("MoreLines2").Position = msoBarLeft 'not work ; I don't know how to dock it on the left
End Sub
Size and Position
Sub openPaneSltObjSize()
ActiveWindow.Activate
If Not CommandBars.GetPressedMso("SelectionPane") Then CommandBars.ExecuteMso ("SelectionPane") 'y
'Application.CommandBars.ExecuteMso ("SelectionPane") 'y but little problem
ActiveWindow.View.Slide _
.Shapes.Placeholders.Item(3).TextFrame.TextRange.Select 'need select obj or will bug
Application.CommandBars.ExecuteMso ("ObjectSizeAndPositionDialog")
'Application.CommandBars("ObjectSizeAndPositionDialog").Position = msoBarLeft 'not work ; I don't know how to dock it on the left
End Sub
Picture Corrections Crop
need select Pic first
Sub openPanePicPst()
ActiveWindow.Activate
If Not CommandBars.GetPressedMso("SelectionPane") Then CommandBars.ExecuteMso ("SelectionPane") 'y
'Application.CommandBars.ExecuteMso ("SelectionPane") 'y but little problem
Application.CommandBars.ExecuteMso ("PictureCorrectionsDialog") 'need select Pic or will bug
'Application.CommandBars("PictureCorrectionsDialog").Position = msoBarLeft 'not work ; I don't know how to dock it on the left
End Sub
But I still can't find a way
Dock The following TaskPanes are on the left,
and are expanded.
Fill and Line
Size and Position
Picture Corrections Crop
If there is a very good person
willing to help
I would be very grateful to him

How To Change CommandButton Color, PowerPoint VBA

I want to have the color of my CommandButton change to black when it is clicked. I am programming with VBA in PowerPoint. I have already tried this:
With ActivePresentation.Shapes("MyButton").Fill
.Color.RGB = RGB(0, 0, 0)
End With
Of course, the above code should run on click.
Thanks in advance.
Wow! I can't believe I thought of this so fast!
This is the code that works:
MyButton.BackColor = 0
It changes the background color to black!

Change colour of highlighted text of a textbox in PowerPoint VBA

So I want to have a button that changes the selected/highlighted text of a TextBox in PowerPoint VBA.
I know how to change all the text on a TextBox, but not the selected/highlighted.
Thanks for reading.
You'd want to ensure that there's a current selection and that the selection is text before trying to change anything:
With ActiveWindow.Selection
If .Type = ppSelectionText Then ' Text is selected
' Make it green, for example:
.TextRange.Font.Color.RGB = RGB(0, 255, 0)
End If
End With

VBA UI Textboxes background turns black

I have a series of Excel VBA projects with UI's and have never had any problems. We have now migrated to Windows 7 and some users have noted that the textbox control backgrounds are rendering to black on selection of the control (through selection of a radio button).
Today, after rebooting my computer, the same has happened. This is the code of the radio button event that activates the Text Box.
Private Sub optUserInput_Click()
With frmBOMReport.txtPN
.Enabled = True
.Locked = False
.BackColor = &H80000009 'White Background
End With
The default is &H80000005&.
Has anyone experienced this and if so, what is going on here?
Thanking you in advance for any responses to this.
Carlo
Option 1
Use the RGB Function
Private Sub optUserInput_Click()
With frmBOMReport.txtPN
.Enabled = True
.Locked = False
.BackColor = RGB(255,255,255) 'White Background
End With
&H80000009 is a VB Const that represents the color of text in caption. So if the text is black your code will black your control's back color.
Option 2
Use &HFFFFFF const which is the defacto VB const for the color white.

change the color of text in Powerpoint depending on the initial color

I have 1000 powerpoint presentations where I need to change the font color from white to black. I have found http://answers.microsoft.com/en-us/office/forum/office_2007-powerpoint/vba-powerpoint-how-to-change-the-font-color-from/eea94b23-0892-437f-b64c-6a240f000227 but this only works if all the text in a text box is white. There are currently highlights in many text boxes and then the color is not changed. Anyone know how to do this, or just to inspect one character at a time?
Please. Doing it manually would be terrible.
In round numbers, like so, assuming you've dimmed oSh as Shape, gotten a reference to oSl as Slide. You'd need to add tests to make sure that the shape does have a textframe and the textframe has text. This won't touch shapes in groups or text in tables etc. but it's a start.
For Each oSh In oSl.Shapes
For x = 1 To oSh.TextFrame.TextRange.Characters.Count
With oSh.TextFrame.TextRange.Characters(x)
' if the charcter's color is white, make it black
If .Font.Color.RGB = RGB(255, 255, 255) Then
.Font.Color.RGB = RGB(0, 0, 0)
End If
End With
Next
Next