VBA Express Forum  




Go Back   VBA Express Forum > VBA Code & Other Help > PowerPoint Help
     Feedback     
Register FAQ Members Arcade Knowledge Base Training Articles Consulting

Reply
 
Thread Tools Display Modes
Old 04-16-2012, 03:55 AM   #1
lesaussice

 
Joined: Apr 2012
Posts: 11
Kb Entries: 0
Articles: 0
Powerpoint underline style

I can't figure out the syntax for the new underline styles in Powerpoint 2007 onwards. I need to set a dotted underline to a TextRange (underline style > dotted line from the Font dialog) but can't find the attribute. I can only work out how to turn on underline and it uses the default solid underline.

Code currently like this..

With rngUnderline
.Font.Underline = msoTrue
End With

You'd think there was a .Font.Underline.Style property but seemingly not. Anyone got any ideas?

Last edited by lesaussice : 04-16-2012 at 04:42 AM.

Local Time: 01:12 AM
Local Date: 05-24-2013
Location:

 
Reply With Quote Top
Old 04-16-2012, 06:26 AM   #2
John Wilson

 
Joined: Feb 2007
Posts: 839
Kb Entries: 1
Articles: 0
To use the new text features you must work with the TextFrame2 object. In 2007 this is a bit broken so you might want to explain how you referenced mgunderline. In 2010 you can use TextRange2.

VBA:
Sub newstuff() 'This is broken in 2007 but works in 2010! Dim otx2 As TextRange2 Set otx2 = ActiveWindow.Selection.TextRange2 otx2.Font.UnderlineStyle = msoUnderlineDotDashLine End Sub
VBA tags courtesy of www.thecodenet.com


John Wilson
Microsoft PowerPoint MVP
Amazing Free PowerPoint Tutorials
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html

Local Time: 01:12 AM
Local Date: 05-24-2013
Location:

 
Reply With Quote Top
Old 04-16-2012, 06:56 AM   #3
lesaussice

 
Joined: Apr 2012
Posts: 11
Kb Entries: 0
Articles: 0
John,

Great, that's solved it..

RngUnderline was set to a specific character range via the TextFrame rather than the TextFrame2 object. Like you say, things are a bit broken in PPT 2007 but I'm now able to use UnderlineStyle to apply my dotted underline.

Cheers

Local Time: 01:12 AM
Local Date: 05-24-2013
Location:

 
Reply With Quote Top
Old 04-17-2012, 01:08 AM   #4
John Wilson

 
Joined: Feb 2007
Posts: 839
Kb Entries: 1
Articles: 0
Can you try changing the undeline color with vba and tell me what you see.


John Wilson
Microsoft PowerPoint MVP
Amazing Free PowerPoint Tutorials
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html

Local Time: 01:12 AM
Local Date: 05-24-2013
Location:

 
Reply With Quote Top
Old 05-01-2012, 03:22 AM   #5
lesaussice

 
Joined: Apr 2012
Posts: 11
Kb Entries: 0
Articles: 0
Sorry.. Taken me a while to come back to this. I did get around the problem, but I had to do it by referring to the shape's textframe2 (and then the characters within it) rather than setting those characters as a range and then applying the underlinestyle to it. The latter (bizarely) results in PPT not exposing the relevant properties.

Coming from Excel / Access, PPT VBA is quite odd and seems a bit unloved by MS..

Local Time: 01:12 AM
Local Date: 05-24-2013
Location:

 
Reply With Quote Top
Reply



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 On
HTML code is Off
Forum Jump


All times are GMT -7. The time now is 05:12 PM.


Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright © 2004 - 2012 VBA Express