Hi, Pawel -
Application performance is affected by a lot of factors and a lot of the discussion involving performance is subjective... personal observations instead of measurements.
I took the code snippet you supplied, corrected the error "FontName.Count" instead of "FontNames.Count", and added some timing collection and reporting messageboxes, in five different PB versions/configurations. For each configuration, I ran the code four times and calculated the average elapsed time. Word reports that I have 180 fonts on my PC. All timings were made when running the code/app in the IDE.
Results:
PB 2017 R3 (32-bit): Average: 0.763 seconds
PB 2019 R3 (32-bit): Average: 0.657 seconds
PB 2021 (32-bit): Average: 0.722 seconds
PB 2022 R2 (32-bit): Average: 0.690 seconds
PB 2022 R2 (64-bit): Average: 0.570 seconds
I see no evidence of "very slow" performance on my system. If you have other workstations you can test on, I suggest you do so, as there may be something unique to your PC.
If you or anyone else wants to measure the performance, I'm posting the code I used:
Integer li_rc, li_count, li_index
Decimal ldec_beg, ldec_end, ldec_elapsed
String ls_fontname, ls_beg, ls_end
Time lt_beg, lt_end
OleObject lole_word
lole_word = CREATE OleObject
If Not IsValid(lole_word) Then Return 0
li_rc = lole_word.ConnectToNewObject("Word.Application")
li_count = lole_word.Application.FontNames.Count
lt_beg = Now()
For li_index = 1 To li_count
ls_fontname = lole_word.Application.FontNames.Item(li_index)
Next
lt_end = Now()
ls_beg = String(lt_beg,'hh:mm:ss.fff')
ls_end = String(lt_end,'hh:mm:ss.fff')
ldec_beg = Dec(Mid(ls_beg,7))
ldec_end = Dec(Mid(ls_end,7))
If ldec_end < ldec_beg Then ldec_end += 60.0
ldec_elapsed = ldec_end - ldec_beg
MessageBox("PB 2017 R3","# of Fonts: ~t" + String(li_count) + &
"~r~n~r~nEnd time: ~t" + ls_end + &
"~r~nBegin time: ~t" + ls_beg + &
"~r~n~t~t-----------------~r~nElapsed: ~t~t00:00:" + &
String(ldec_elapsed,"00.000"))
lole_word.DisconnectObject()
DESTROY lole_word
Return 0
Best regards, John