问题
I've written a small programm in MS Word VBA that is working perfectly fine for all windows machines I've deployed it to. However the computers running macOS seem to have trouble with it.
In a collection I always store an array as value and give it a unique key. These arrays always contain a sequence (like 'a\') at index 0 and up to 5 combining diacritical marks. These diacritical marks, such as the accent grave (on the à for example), are stored via their numerical value, in this case '0300'.
If a user opens the my userform via CTRL+SPACE and types a\ in the search field ('Crea') a listbox ('Risultati') displays possible matches of this sequence, in this case à. This is achieved by looping through the collection, checking the sequence at index 0 with the search entry and if its a match the listbox.AddItem ChrW("&H" & collection(1)) & ChrW("&H" & collection(2)
function combines these diacrital marks to the respective character and displays them in the list. Also the sequence of a character is displayed in the 'sequenza' field if you focus a character from the listbox. Afterwards the user can decide which character from the list shall be inserted. I reference the selected listbox index an insert the selection in the document.
Selection.InsertBefore listbox.Column(0, listbox.ListIndex)
Now for the fun part:
Some characters of the listbox are not combined correctly, though when inserted, are correct.
For example e? gets combined in the listbox to ḗ even though it should be ẹ. It does get inserted correctly (as ẹ) though.
Now the exact same code on a windows machine does combine the character correctly:
Also after narrowing down the search criteria in the 'crea' field, the characters are displayed correctly: See
and matched character two
I have no idea what causes this behaviour and appreciate every suggestion.
来源:https://stackoverflow.com/questions/58281268/word-macro-behaves-different-on-macos