VBA - Styles

Styles apply to a single workbook and cannot be easily transferred to other workbooks.


Selection.Style = "Normal" 

ActiveWorkbook.Styles.Add(Name:="your style name") 
ActiveWorkBook.Styles("your style name").Font.Name = "Arial"


Public Sub DeleteStyles() 
Dim objStyle As Style
Dim iReturn As Integer

   For Each objStyle In ActiveWorkbook.Styles
      If (objStyle.BuiltIn = False) Then
         iReturn = MsgBox("Do you want to delete this style: """ & objStyle.Name & """ ?", vbYesNo)
         If (iReturn = vbYes) Then
            objStyle.Delete
         End If
      End If
   Next objStyle
End Sub


Merging Styles ??


Copy in worksheets that have a Normal style
New / More / Additional styles are added !!!


AutoFormat


objRange.AutoFormat.Format:=xlRangeAutoFormatNone, _ 
                  Number:=True
                  Font:=True
                  Alignment:=
                  Border:=True
                  Pattern:=True
                  Width:=

Themes


ActiveWorkbook.Theme.ThemeColorScheme.Load("C:\temp\mytheme.xml") 

Debug.Print ActiveWorkbook.Theme.ThemeFontScheme.MajorFont(msoFontLanguageIndex.msoThemeLatin).Name 
Debug.Print ActiveWorkbook.Theme.ThemeFontScheme.MinorFont(msoFontLanguageIndex.msoThemeLatin).Name



© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext