Vba – Change default text direction in a powerpoint presentation using VBA

powerpointright-to-lefttext;vba

I use the Powerpoint Object-Model to programmatically create a presentation in PowerPoint 2007.

Some of the computers on which I run my program have PowerPoint set with Hebrew as the Primary Editing Language.
(to change the primary language, push the "Office" button, then "Powerpoint options", and go to Popular->Language Settings->Primary Editing Language)

On these computers, when I run my program, all the text in the created presentation (wrongly) appears right-justified and the bullets appear to the right of the text.

I could fix this by editing the ppt/presentation.xml in the resulting presentation PPTX file. I adjust the Alignment and RightToLeft properties in the "Default Text Styles" for each bullet level. However, XML editing is not a good option for this project.

How can I change the default text direction in a presentation using the Object Model (i.e., VBA), besides changing each TextBox individually?


Thanks for the suggestions,

What I tried:

I performed Application.Presentations(1).LayoutDirection = ppDirectionLeftToRight, which changes the direction of the PowerPoint user-interface. I also changed Application.Presentations(1).LanguageID to US English.
Unfortunately, doing these things did not solve the problem of the right-to-left text in the created presentation.

So finally I gave up on changing the parameters for the Presentation itself and indeed directly changed ParagraphFormat.TextDirection and ParagraphFormat.Alignment for each Run of each TextBox which I initially tried to avoid, and naturally this had the desired effect.

Best Answer

In C# it will look this way:

textbox.TextFrame.TextRange.ParagraphFormat.TextDirection = PpDirection.ppDirectionRightToLeft
Related Topic