Microsoft Office VBA

General VBA

Add-in in Developer VBA IDE (debug)

  • HKEY_CURRENT_USER\Software\Microsoft\Office\X\PowerPoint\Options > DWORD DebugAddins = 1

Colors in UserForms

PowerPoint VBA

Font

  • Change font to Headings or Body font:
    • {object}.Font.Name = "+" + FontType + "-" + FontLang
      • FontType is "mj" or "mn" for Major (headings) or Minor (body) respectively.
      • FontLang is "lt", "cs" or "ea" for Latin, Complex Scripts or East Asian
    • For example to set the font to the theme's body text font for Latin text: ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Font.Name = "+mn-lt"

ThemeColors

Name Value Description
msoNotThemeColor 0 Specifies no theme color
msoThemeColorAccent1 5 Specifies the Accent 1 theme color
msoThemeColorAccent2 6 Specifies the Accent 2 theme color
msoThemeColorAccent3 7 Specifies the Accent 3 theme color
msoThemeColorAccent4 8 Specifies the Accent 4 theme color
msoThemeColorAccent5 9 Specifies the Accent 5 theme color
msoThemeColorAccent6 10 Specifies the Accent 6 theme color
msoThemeColorBackground1 14 Specifies the Background 1 theme color
msoThemeColorBackground2 16 Specifies the Background 2 theme color
msoThemeColorDark1 1 Specifies the Dark 1 theme color
msoThemeColorDark2 3 Specifies the Dark 2 theme color
msoThemeColorFollowedHyperlink 12 Specifies the theme color for a clicked hyperlink
msoThemeColorHyperlink 11 Specifies the theme color for a hyperlink
msoThemeColorLight1 2 Specifies the Light 1 theme color
msoThemeColorLight2 4 Specifies the Light 2 theme color
msoThemeColorMixed -2 Specifies a mixed color theme
msoThemeColorText1 13 Specifies the Text 1 theme color
msoThemeColorText2 15 Specifies the Text 2 theme color

PasteSpecial

  • PasteSpecial values:
Paste Type Enum VBA Code
Bitmap 1 ppPasteBitmap
Default 0 ppPasteDefault
Enhanced Metafile 2 ppPasteEnhancedMetafile
GIF 4 ppPasteGIF
HTML 8 ppPasteHTML
JPG 5 ppPasteJPG
Metafile Picture 3 ppPasteMetafilePicture
OLE Object 10 ppPasteOLEObject
PNG 6 ppPastePNG
RTF 9 ppPasteRTF
Shape 11 ppPasteShape
Text 7 ppPasteText
Sub EnhancedMetafile_Paste()
'PURPOSE:Paste Contents as PasteSpecial Enhanced Metafile
'SOURCE: www.TheSpreadsheetGuru.com
Dim Sld As Slide
'Ensure focus is on slide
    Application.ActiveWindow.Panes(2).Activate
    Set Sld = Application.ActiveWindow.View.Slide
    On Error GoTo NoCopy
        Sld.Shapes.PasteSpecial (ppPasteEnhancedMetafile)
    On Error GoTo 0
Exit Sub
NoCopy:
    MsgBox "There was nothing copied to paste!"
End Sub

Office Ribbon

Office RibbonX Editor

Microsoft Docs