UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> change text color in PPT, Any Version    
 
   
evtilsley
post Jul 17 2020, 10:48 AM
Post#1



Posts: 6
Joined: 17-July 20



Hi - just joined smile.gif
I spent ages trying to get this to work. Well... failing to get this to work. Is it possible for someone here to share a working version with me, please? Not tinkered with VBA in PPT before.. I had a little success but stuck now (Attached)
This post has been edited by evtilsley: Jul 17 2020, 10:49 AM
Attached File(s)
Attached File  change_text_color.zip ( 30K )Number of downloads: 3
 
Go to the top of the page
 
GroverParkGeorge
post Jul 18 2020, 09:15 AM
Post#2


UA Admin
Posts: 37,627
Joined: 20-June 02
From: Newcastle, WA


What, exactly, are you hoping to accomplish again?

You posted a PPT of something but it's hard to know what the purpose is.

Thanks for clarifying your problem.

--------------------
My Real Name Is George. Grover Park Consulting is where I did business for 20 years.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 
Gustav
post Jul 19 2020, 04:01 AM
Post#3


UtterAccess VIP
Posts: 2,304
Joined: 21-February 07
From: Copenhagen


If you have more than a few textboxes to sport this feature, code will soon be messy.
That you can solve by using WithEvents - a hidden an poorly documented feature of Access.

In introduction and demo (covering exactly your case) by John Colby can be found here.
Another example is attached my tiny project VBA.ModernTheme.

--------------------
Microsoft Office 365 (Access) MVP 2017 ->
Go to the top of the page
 
tina t
post Jul 19 2020, 05:08 AM
Post#4



Posts: 6,741
Joined: 11-November 10
From: SoCal, USA


QUOTE
Not tinkered with VBA in PPT before

are you trying to do this in Powerpoint? in other words, not in MS Access?

hth
tina

--------------------
"the wheel never stops turning"
Go to the top of the page
 
cheekybuddha
post Jul 19 2020, 06:06 AM
Post#5


UtterAccess Moderator
Posts: 13,120
Joined: 6-December 03
From: Telegraph Hill


Hi,

You can see if this tweaked version of your attachment helps at all.

However, the effect is not very good. frown.gif

I surrounded your textbox with four (invisible) rectangles which, when you mouse over them, call a sub to reset the textbox background colour.

In all honesty, you would probably be better off learning to code some html/javascript and creating this in a web browser. The screen reacts much better to mouse actions than ppt/VBA.

hth,

d


Attached File(s)
Attached File  20200719_change_text_color.zip ( 37.58K )Number of downloads: 2
 

--------------------


Regards,

David Marten
Go to the top of the page
 
evtilsley
post Jul 19 2020, 05:39 PM
Post#6



Posts: 6
Joined: 17-July 20



What I'm looking to do is in PPT, having a slide with say 8 text items which link to other slides. I'm fine doing the links, but I need help if possible adding a mouse over change to the text - either text color, or text transparency smile.gif
Go to the top of the page
 
evtilsley
post Jul 19 2020, 05:48 PM
Post#7



Posts: 6
Joined: 17-July 20



That's really close to what I need smile.gif Any way you can share with me how to change the transparency or color of the text, and leave the background as is?
Thanks!
Go to the top of the page
 
cheekybuddha
post Jul 21 2020, 04:04 AM
Post#8


UtterAccess Moderator
Posts: 13,120
Joined: 6-December 03
From: Telegraph Hill


Hi,

Try adjusting the procedures:
CODE
Public Sub GraphicHover(ByRef oGraphic As Shape)

'  Debug.Print oGraphic.Name
  With oGraphic.Fill
'    If Not .ForeColor.ObjectThemeColor = msoThemeColorAccent2 Then .ForeColor.ObjectThemeColor = msoThemeColorAccent2
    If Not .ForeColor.RGB = RGB(255, 0, 0) Then .ForeColor.RGB = RGB(0, 0, 0)
'    If Not .BackColor.RGB = RGB(0, 0, 255) Then .BackColor.RGB = RGB(0, 0, 255)
  End With
  
End Sub

Public Sub GraphicMouseOut(ByRef oGraphic As Shape)

'  Debug.Print oGraphic.Name
  With ActivePresentation.Slides(1).Shapes("TextBox 1").Fill
    If Not .ForeColor.RGB = RGB(255, 255, 255) Then .ForeColor.RGB = RGB(255, 255, 255)
'    If Not .BackColor.RGB = RGB(0, 0, 0) Then .BackColor.RGB = RGB(0, 0, 0)
  End With
  
End Sub


hth,

d

--------------------


Regards,

David Marten
Go to the top of the page
 
evtilsley
post Jul 22 2020, 09:53 AM
Post#9



Posts: 6
Joined: 17-July 20



Hi - thanks so much for revised code.

When I try the new code, it's still the box holding the text that's changing color (to black now), not the TEXT itself. I assume 'With oGraphic.Fill' is the box, not the text?
I'll start having some guesses at the code - unless you know how?
Go to the top of the page
 
cheekybuddha
post Jul 22 2020, 10:48 AM
Post#10


UtterAccess Moderator
Posts: 13,120
Joined: 6-December 03
From: Telegraph Hill


Yes, the Powerpoint Object Model is seriously confusing!

Try:
CODE
Public Sub GraphicHover(ByRef oGraphic As Shape)

  With oGraphic.TextFrame.TextRange.Font.Color
    If Not .RGB = RGB(255, 0, 0) Then .RGB = RGB(0, 0, 0)
  End With
  
End Sub

Public Sub GraphicMouseOut(ByRef oGraphic As Shape)

  With ActivePresentation.Slides(1).Shapes("TextBox 1").TextFrame.TextRange.Font.Color
    If Not .RGB = RGB(255, 255, 255) Then .RGB = RGB(255, 255, 255)
  End With
  
End Sub


--------------------


Regards,

David Marten
Go to the top of the page
 
evtilsley
post Jul 22 2020, 11:01 AM
Post#11



Posts: 6
Joined: 17-July 20



Nice!
I made a few changes to this which works very nicely - thanks !

Option Explicit

Public Sub GraphicHover(ByRef oGraphic As Shape)

With oGraphic.TextFrame.TextRange.Font.Color
If Not .RGB = RGB(255, 0, 0) Then .RGB = RGB(0, 0, 0)
End With

End Sub

Public Sub GraphicMouseOut(ByRef oGraphic As Shape)

With ActivePresentation.Slides(1).Shapes("TextBox 1").TextFrame.TextRange.Font.Color
If Not .RGB = RGB(99, 99, 99) Then .RGB = RGB(99, 99, 99)
End With

End Sub


I wonder... Is there a way to detect the cursor moving off the text object itself, so we dont need to add the second object
Go to the top of the page
 
cheekybuddha
post Jul 22 2020, 11:09 AM
Post#12


UtterAccess Moderator
Posts: 13,120
Joined: 6-December 03
From: Telegraph Hill


Just noted an mistake in one of the lines:
CODE
Public Sub GraphicHover(ByRef oGraphic As Shape)

  With oGraphic.TextFrame.TextRange.Font.Color
'    If Not .RGB = RGB(255, 0, 0) Then .RGB = RGB(0, 0, 0)
    If Not .RGB = RGB(255, 0, 0) Then .RGB = RGB(255, 0, 0)
  End With
  
End Sub

--------------------


Regards,

David Marten
Go to the top of the page
 
evtilsley
post Jul 24 2020, 11:36 AM
Post#13



Posts: 6
Joined: 17-July 20



Hi geniuses... smile.gif
Is there a way to detect 'mouse out' without needing a bounding box? I tried hacking the code without luck
My slide has a few text boxes that need to be quite close + bounding boxes will be a PITA !
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    5th August 2020 - 05:38 AM