banner
Vinking

Vinking

你写下的每一个BUG 都是人类反抗被人工智能统治的一颗子弹

生成 PPT 專用的雲朵字體

Important

🔔該生成器的相容性

該生成器編寫於 Office 365 版本的 PowerPoint,Office 系列應該都能正常使用。下載前請先確認您使用的 PowerPoint 是否為 Office 系列。

🔔為什麼 WPS 系列不適用?

根據 WPS 使用文檔:如果需要使用 VBA 宏功能,需要購買 WPS 的商業標準版或者商業高級版,個人版是沒有宏的使用權限的。詳細信息請參考:如何獲取 VBA 宏的使用權限

🔔我可以將這個生成器分享給別人嗎?

可以,本作品遵循 MIT License 協議

🔔使用問題

如果使用時有問題請直接在本頁面留言或者發郵件到 i#mail.vinking.top(將 # 替換為 @ )都可以得到及時的回覆。

這兩天女朋友說要上公開課,得用雲朵字體來做 PPT。類似於下面這種:

雲朵字體

大概原理就是將文本框額外複製兩份,然後調整那兩份的文字輪廓。最後將這三個文本框對齊即可。

雲朵字體製作

在網上轉了一圈,雲朵字體的免費教程都是教你怎麼自己一個個來做,非常非常麻煩;而生成器則是需要付費的,看了看演示發現預設的效果比較少而且還不太好看。後面就自己用 PPT 自帶的 VBA 做了一個可以自定義比較多選項的雲朵字體生成器給她,可以按照設定一鍵生成並且複製雲朵字體。

生成器使用

具體的 VBA 如下,可以在 PPT 裡面以宏的形式使用:

Private Sub CommandButton1_Click()
    With ActivePresentation.Slides(1)
        If IsNumeric(.Shapes("FirstBackgroundColor_R_Box").OLEFormat.Object.Text) _
          And IsNumeric(.Shapes("FirstBackgroundColor_G_Box").OLEFormat.Object.Text) _
          And IsNumeric(.Shapes("FirstBackgroundColor_G_Box").OLEFormat.Object.Text) _
          And IsNumeric(.Shapes("SecondBackgroundColor_R_Box").OLEFormat.Object.Text) _
          And IsNumeric(.Shapes("SecondBackgroundColor_G_Box").OLEFormat.Object.Text) _
          And IsNumeric(.Shapes("SecondBackgroundColor_B_Box").OLEFormat.Object.Text) _
          And IsNumeric(.Shapes("TextColor_R_Box").OLEFormat.Object.Text) _
          And IsNumeric(.Shapes("TextColor_G_Box").OLEFormat.Object.Text) _
          And IsNumeric(.Shapes("TextColor_B_Box").OLEFormat.Object.Text) _
          And IsNumeric(.Shapes("FontSizeBox").OLEFormat.Object.Text) Then
          
            TextBoxValue = .Shapes("TextBox").OLEFormat.Object.Text
            FontSizes = .Shapes("FontSizeBox").OLEFormat.Object.Text
            
            FirstBackgroundColor_R = .Shapes("FirstBackgroundColor_R_Box").OLEFormat.Object.Text
            FirstBackgroundColor_G = .Shapes("FirstBackgroundColor_G_Box").OLEFormat.Object.Text
            FirstBackgroundColor_B = .Shapes("FirstBackgroundColor_B_Box").OLEFormat.Object.Text
            
            SecondBackgroundColor_R = .Shapes("SecondBackgroundColor_R_Box").OLEFormat.Object.Text
            SecondBackgroundColor_G = .Shapes("SecondBackgroundColor_G_Box").OLEFormat.Object.Text
            SecondBackgroundColor_B = .Shapes("SecondBackgroundColor_B_Box").OLEFormat.Object.Text
            
            TextColor_R = .Shapes("TextColor_R_Box").OLEFormat.Object.Text
            TextColor_G = .Shapes("TextColor_G_Box").OLEFormat.Object.Text
            TextColor_B = .Shapes("TextColor_B_Box").OLEFormat.Object.Text
            
            If .Shapes("Text").HasTextFrame Then
                With .Shapes("Text").TextFrame.TextRange
                    .Text = TextBoxValue
                    .Font.Size = FontSizes
                    .Font.Color.RGB = RGB(TextColor_R, TextColor_G, TextColor_B)
                End With
            End If
            
            If .Shapes("FirstBackground").HasTextFrame Then
                With .Shapes("FirstBackground")
                    .TextFrame.TextRange.Text = TextBoxValue
                    .TextFrame.TextRange.Font.Size = FontSizes
                    With .TextFrame2.TextRange.Font.Line
                        .Visible = msoTrue
                        .ForeColor.RGB = RGB(FirstBackgroundColor_R, FirstBackgroundColor_G, FirstBackgroundColor_B)
                        .Transparency = 0
                        .Visible = msoTrue
                        .Weight = 25
                    End With
                End With
            End If
            
            If .Shapes("SecondBackground").HasTextFrame Then
                With .Shapes("SecondBackground")
                    .TextFrame.TextRange.Text = TextBoxValue
                    .TextFrame.TextRange.Font.Size = FontSizes
                    With .TextFrame2.TextRange.Font.Line
                        .Visible = msoTrue
                        .ForeColor.RGB = RGB(SecondBackgroundColor_R, SecondBackgroundColor_G, SecondBackgroundColor_B)
                        .Transparency = 0
                        .Visible = msoTrue
                        .Weight = 50
                    End With
                End With
            End If
            
            With .Shapes.Range(Array("Text", "FirstBackground", "SecondBackground"))
                .TextFrame.HorizontalAnchor = msoAnchorCenter
                .TextFrame.VerticalAnchor = msoAnchorMiddle
                .TextFrame.WordWrap = msoTrue
                .TextFrame.AutoSize = ppAutoSizeShapeToFitText
                .Copy
            End With
        Else
            MsgBox "文字大小、背景顏色輸入框請輸入數字"
            End
        End If
    End With
End Sub

Private Sub CommandButton2_Click()
    With ActivePresentation.Slides(1)
        .Shapes("TextBox").OLEFormat.Object.Text = "A"
        .Shapes("FontSizeBox").OLEFormat.Object.Text = 60
        
        With .Shapes("Text").TextFrame.TextRange
            .Text = "A"
            .Font.Size = 60
            .Font.Color.RGB = RGB(0, 0, 0)
        End With
        
        With .Shapes("FirstBackground")
            .TextFrame.TextRange.Text = "A"
            .TextFrame.TextRange.Font.Size = 60
            With .TextFrame2.TextRange.Font.Line
                .Visible = msoTrue
                .ForeColor.RGB = RGB(255, 255, 255)
                .Transparency = 0
                .Visible = msoTrue
                .Weight = 25
            End With
        End With
        
        With .Shapes("SecondBackground")
            .TextFrame.TextRange.Text = "A"
            .TextFrame.TextRange.Font.Size = 60
            With .TextFrame2.TextRange.Font.Line
                .Visible = msoTrue
                .ForeColor.RGB = RGB(39, 154, 225)
                .Transparency = 0
                .Visible = msoTrue
                .Weight = 50
            End With
        End With
                
        .Shapes("TextColor_R_Box").OLEFormat.Object.Text = 0
        .Shapes("TextColor_G_Box").OLEFormat.Object.Text = 0
        .Shapes("TextColor_B_Box").OLEFormat.Object.Text = 0
        
        .Shapes("FirstBackgroundColor_R_Box").OLEFormat.Object.Text = 255
        .Shapes("FirstBackgroundColor_G_Box").OLEFormat.Object.Text = 255
        .Shapes("FirstBackgroundColor_B_Box").OLEFormat.Object.Text = 255
        
        .Shapes("SecondBackgroundColor_R_Box").OLEFormat.Object.Text = 39
        .Shapes("SecondBackgroundColor_G_Box").OLEFormat.Object.Text = 154
        .Shapes("SecondBackgroundColor_B_Box").OLEFormat.Object.Text = 225
    End With
    
    MsgBox "初始化完成"
End Sub

不想自己弄的話這裡也有一整個生成器的 PPT 文件:

123 網盤(推薦)

百度網盤(備份)

此文由 Mix Space 同步更新至 xLog
原始鏈接為 https://www.vinking.top/posts/codes/create-cloud-font-with-vba-in-ppt


載入中......
此文章數據所有權由區塊鏈加密技術和智能合約保障僅歸創作者所有。