简体   繁体   中英

Powerpoint VBA - Change Color Scheme

I need to change color scheme of presentation to Office 2007-2010 though VBA code. How can I do that?

在此处输入图片说明

I tried something like below but doesn't seem to work.

ActivePresentation.ColorSchemes.Add
ActivePresentation.ColorSchemes(1).Colors(ppAccent1).RGB = RGB(0, 0, 1)
ActivePresentation.ColorSchemes(1).Colors(ppAccent1).RGB = RGB(0, 0, 2)

Changing color schemes in PowerPoint should be like this:

ActivePresentation.SlideMaster.Theme.ThemeColorScheme(msoThemeAccent1) = RGB(1, 2, 3)

There is a whole answer here:

https://answers.microsoft.com/en-us/msoffice/forum/msoffice_powerpoint-mso_winother/change-color-theme-using-vba-in-powerpoint/0efe38ad-36cb-4df7-b6e6-ed389c364f53

Sub mkThemeCols()
With ActivePresentation.SlideMaster.Theme
.ThemeColorScheme(msoThemeAccent1) = RGB(255, 0, 0)
.ThemeColorScheme(msoThemeAccent2) = RGB(0, 255, 0)
.ThemeColorScheme(msoThemeAccent3) = RGB(0, 255, 255)
.ThemeColorScheme(msoThemeAccent4) = RGB(255, 255, 0)
.ThemeColorScheme(msoThemeAccent5) = RGB(23, 255, 10)
.ThemeColorScheme(msoThemeAccent6) = RGB(23, 255, 100)
.ThemeColorScheme(msoThemeDark1) = RGB(23, 0, 0)
.ThemeColorScheme(msoThemeDark2) = RGB(23, 23, 23)
.ThemeColorScheme.Save Environ("APPDATA") & "\Microsoft\Templates\Document Themes\Theme Colors\myNew Theme.xml"
End With
End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM