WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Excel
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Enumerate Fonts in Excel

 Keywords:  list fonts Excel

Sample:

;Enumerate Fonts in Excel
oApplication                  = ObjectOpen("Excel.Application")

;	add a blank workbook...
oWorkbook = oApplication.workbooks
oWorkbook.add

oApplication.Visible          = @TRUE  ; Chnage to @False to hide
oApplication.UserControl      = @FALSE
oApplication.DisplayAlerts    = @FALSE
oApplication.ScreenUpdating   = @FALSE
oCmdcollection        		   = oApplication.CommandBars

oCmdbar = oCmdcollection.Item("Formatting")
oCtrlcollection  = oCmdbar.Controls
oFontsCombobox = oCtrlcollection.Item(1);Grabs the Font Control
;message("oFontsCombobox caption",oFontsCombobox.Caption)
;oFontsCombobox.Enabled = @True
;message("oFontsCombobox Enabled",oFontsCombobox.Enabled)

fontlist =""
cnt = oFontsCombobox.ListCount
For i = 0 To cnt - 1
 font= oFontsCombobox.List(i + 1)
 fontlist = StrCat(fontlist,@tab,font)
Next
fontlist = StrTrim(fontlist)
AskItemList("List of Fonts in Excel",fontlist,@tab,@Unsorted,@Single)

oApplication.Quit
ObjectClose(oFontsCombobox)
ObjectClose(oCtrlcollection)
ObjectClose(oCmdbar)
ObjectClose(oCmdcollection)
ObjectClose(oWorkbook)
ObjectClose(oApplication)

Article ID:   W15252
File Created: 2002:09:05:13:50:50
Last Updated: 2002:09:05:13:50:50