PDA

View Full Version : [SOLVED:] Show alt text from a shape to others shape



yrald47
04-23-2018, 09:55 AM
Hi everyone

I want when I click the object that have an alt text, the alt text will appear in the other shape's text frame

and I got the code, here is the code


Sub changeText(oshp As Shape)
Dim osld As Slide
Dim otxtR As TextRange
Set osld = oshp.Parent
Set otxtR = osld.Shapes("mendatar").TextFrame.TextRange
otxtR = oshp.AlternativeText
End Sub

But, I want the alt text that I separated with new line (or other sign like semicolon, etc) will appear in other shape that different with alt before the separator

Like this :
Shape A have an alt text : "This is alt text ; This will appear in different shape"

When I click Shape A, "This is alt text" will appear in Shape B, and "This will appear in different shape" will appear in shape C

How to do that ?
Thank you

Paul_Hossler
04-25-2018, 07:20 PM
I assumed a semi-colon as seperator, and B and C as the other shapes




Option Explicit
' A to B and C
' alt text in A = "This is alt text ; This will appear in different shape"
' "This is alt text" to B
' "This will appear in different shape" to C

Sub changeText(oShape As Shape)
Dim s As String
Dim i As Long

s = oShape.AlternativeText
i = InStr(s, ";")

oShape.Parent.Shapes("B").TextFrame.TextRange.Text = Trim(Left(s, i - 1))
oShape.Parent.Shapes("C").TextFrame.TextRange.Text = Trim(Right(s, Len(s) - i))
End Sub

yrald47
04-26-2018, 09:07 PM
I'll try it, thanks

yrald47
04-26-2018, 09:42 PM
Great, its work, thank you so much

yrald47
04-26-2018, 09:44 PM
how to mark it to be solved ? i cant find it
how to vote your reply ?

Paul_Hossler
04-27-2018, 07:14 AM
Above your first post is [Thread Tools], one of which [Mark Solved]

To add to a user's rep, there's a Star lower left -- I think you need so many posts before you see it -- not sure, but thanks for the thought anyway