Mark DeMint
asked on
VBScript in Powerpoint - Change Formatting in Text Box on a line-by-line basis
I want to be able to paste text and change the formatting of certain lines in an existing text box, named "author", on my powerpoint file. I have a bank of authors that the user chooses from (1-10). I have a Select Case setup to automatically assign values to variables I'm using to populate the text box with:
The first two lines are Black and Bold Italic, the next two lines are Gray and Italic.
The text box is existing and I'm just replacing placeholder text.
Case Else
strEngName = "<author's name>" 'line 1
strEngTitle = "<author's title>" 'line 2
strPhone = "Office: <author's phone>" 'line 3
strEmail = "Email: <author's email>" 'line 4
The first two lines are Black and Bold Italic, the next two lines are Gray and Italic.
The text box is existing and I'm just replacing placeholder text.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Without seeing the code I cannot say
ASKER
What else do you need to see? At the top I shared a generic case that sets a variable equal to a string. I just want to take the code you supplied and set the content in each line equal to those variables. Then I would have your code format the text.
How do you reference the shape ?
Are the lines CHr(11) or CHr(13) separated?
Are the lines CHr(11) or CHr(13) separated?
ASKER
Not at my work computer right now, but it was similar to how you referenced it, but I named the shape "author".
ActivePresentation.Slides( 1).Shapes( "author"). TextFrame2
As far as the return goes I could use whichever is preferred. I don't recall if it was chr(11) or chr(13), but I can change to either if need be.
ActivePresentation.Slides(
As far as the return goes I could use whichever is preferred. I don't recall if it was chr(11) or chr(13), but I can change to either if need be.
my code should be afterwards since it format the first 2 lines then the 2 remaining lines
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you both! This was exactly what I was looking for.
ASKER
The user will select from a dialog which user they are (1-10) then the text box will automatically place the text and format it. So I've got the formatting like you gave me above, but where do I get it to use values assigned to these variables for the content?