Created
February 18, 2026 08:36
-
-
Save jvarn/de43edb212adab01112e484ad248685b to your computer and use it in GitHub Desktop.
Fix the Arabic letter order in Arabic PowerPoint converted from PDF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Sub FixArabicReverseText() | |
| Dim shp As Shape | |
| Dim originalText As String | |
| Dim reversedText As String | |
| ' Check if anything is actually selected | |
| If ActiveWindow.Selection.Type = ppSelectionNone Then | |
| MsgBox "Please select the text box(es) you want to fix first.", vbExclamation | |
| Exit Sub | |
| End If | |
| ' Loop through every shape in your current selection | |
| On Error Resume Next ' Skip shapes that don't allow text manipulation | |
| For Each shp In ActiveWindow.Selection.ShapeRange | |
| ' Check if the shape can hold text and actually has text | |
| If shp.HasTextFrame Then | |
| If shp.TextFrame.HasText Then | |
| ' 1. Get the current text | |
| originalText = shp.TextFrame.TextRange.Text | |
| ' 2. Reverse the string | |
| reversedText = StrReverse(originalText) | |
| ' 3. Apply the fixed text back to the shape | |
| shp.TextFrame.TextRange.Text = reversedText | |
| ' Optional: Ensure text direction is Right-to-Left | |
| shp.TextFrame.TextRange.ParagraphFormat.TextDirection = ppDirectionRightToLeft | |
| End If | |
| End If | |
| Next shp | |
| On Error GoTo 0 | |
| End Sub |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Step-by-Step Instructions (macOS) | |
| PowerPoint on Mac hides the coding tools by default. Here is how to set it up and use the script: | |
| 1. Enable the Developer Tab | |
| Open PowerPoint. | |
| Click PowerPoint in the top menu bar (top left of your screen) and select Preferences... | |
| Click on Ribbon & Toolbar. | |
| In the right-hand list (under "Main Tabs"), check the box for Developer. | |
| Click Save. You will now see a "Developer" tab in your main PowerPoint ribbon. | |
| 2. Insert the Script | |
| Click the Developer tab. | |
| Click the Visual Basic button (usually on the far left). A new window will open. | |
| In this new window, look at the "Project" pane on the left. Right-click on your presentation name (e.g., VBAProject (Presentation1)). | |
| Note: If you don't see the Project pane, go to View > Project Explorer. | |
| Select Insert > Module. | |
| A blank white window will appear. Paste the code provided above into this window. | |
| Close the Visual Basic window and return to your slide. | |
| 3. Run the Fix | |
| Select the text box(es) on your slide that contain the backwards Arabic. (You can hold Shift and click to select multiple boxes at once). | |
| Go to the Developer tab and click Macros. | |
| Select FixArabicReverseText from the list. | |
| Click Run. |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Codia AI Noteslide does a good job at Arabic PDF OCR and PowerPoint conversion, but it is expensive.
https://codia.ai/noteslide/
Other tools that I have found result in the Arabic letters being reversed in order (e.g. مرحبا will be written as ابحرم).
This VBA script fixes the letter order for such files.