A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Powerpoint, Publisher and Visio » Powerpoint
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

VBA construct



 
 
Thread Tools Display Modes
  #1  
Old December 7th, 2008, 01:47 PM posted to microsoft.public.powerpoint
Chris Watts
external usenet poster
 
Posts: 265
Default VBA construct

I am working on a macro (in PPT2000) and would welcome some advice on a VBA
construct please
The macro writes two lines into a text box using:
..Text = "Line 1" & vbcrlf & vbcrlf & "Line 2"

That works just fine, but I wish the second line to be different by being
italic or another colour.
If I precede it with the line
..Font.Italic = True
then this makes both lines italic. How can I do it for just the second
line - every attempt that I have tried results in Line 1 of the text being
overwritten and Line 2 only appearing in the box!

TIA
Chris


  #2  
Old December 7th, 2008, 04:19 PM posted to microsoft.public.powerpoint
John Wilson
external usenet poster
 
Posts: 6,023
Default VBA construct

I don't have 2000 handy right now but this should work I think:

With ActivePresentation.Slides(1).Shapes(3).TextFrame.T extRange
..Text = "Line 1" & vbCrLf & vbCrLf & "Line 2"
..Lines(3).Font.Italic = msoTrue' note your line 2 is on line 3!
End with
--

john ATSIGN PPTAlchemy.co.uk
Custom vba coding and PPT Makeovers
Free PPT Hints, Tips and Tutorials
http://www.pptalchemy.co.uk/powerpoi...tutorials.html




"Chris Watts" wrote:

I am working on a macro (in PPT2000) and would welcome some advice on a VBA
construct please
The macro writes two lines into a text box using:
..Text = "Line 1" & vbcrlf & vbcrlf & "Line 2"

That works just fine, but I wish the second line to be different by being
italic or another colour.
If I precede it with the line
..Font.Italic = True
then this makes both lines italic. How can I do it for just the second
line - every attempt that I have tried results in Line 1 of the text being
overwritten and Line 2 only appearing in the box!

TIA
Chris



  #3  
Old December 7th, 2008, 05:36 PM posted to microsoft.public.powerpoint
Shyam Pillai
external usenet poster
 
Posts: 622
Default VBA construct

Chris,

With ActivePresentation.Slides(1).Shapes(1).TextFrame.T extRange
.Text = "Line 1" & vbCrLf & vbCrLf
With .InsertAfter
.Text = "Line 2"
.Font.Italic = msoCTrue
End With
End With

Regards,
Shyam Pillai


Animation Carbon: http://animationcarbon.com


"Chris Watts" wrote in message
...
I am working on a macro (in PPT2000) and would welcome some advice on a VBA
construct please
The macro writes two lines into a text box using:
.Text = "Line 1" & vbcrlf & vbcrlf & "Line 2"

That works just fine, but I wish the second line to be different by being
italic or another colour.
If I precede it with the line
.Font.Italic = True
then this makes both lines italic. How can I do it for just the second
line - every attempt that I have tried results in Line 1 of the text being
overwritten and Line 2 only appearing in the box!

TIA
Chris


  #4  
Old December 7th, 2008, 06:25 PM posted to microsoft.public.powerpoint
Chris Watts
external usenet poster
 
Posts: 265
Default VBA construct

Thanks, Shyam and John.
Both work perfectly.
cheers
Chris

"Shyam Pillai" wrote in message
...
Chris,

With ActivePresentation.Slides(1).Shapes(1).TextFrame.T extRange
.Text = "Line 1" & vbCrLf & vbCrLf
With .InsertAfter
.Text = "Line 2"
.Font.Italic = msoCTrue
End With
End With

Regards,
Shyam Pillai


Animation Carbon: http://animationcarbon.com


"Chris Watts" wrote in message
...
I am working on a macro (in PPT2000) and would welcome some advice on a
VBA construct please
The macro writes two lines into a text box using:
.Text = "Line 1" & vbcrlf & vbcrlf & "Line 2"

That works just fine, but I wish the second line to be different by being
italic or another colour.
If I precede it with the line
.Font.Italic = True
then this makes both lines italic. How can I do it for just the second
line - every attempt that I have tried results in Line 1 of the text
being overwritten and Line 2 only appearing in the box!

TIA
Chris




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:06 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.