This worked perfectly, thank you very much!
For anyone else who wants to recreate the entire process:
1. Create a new custom tag called 'Length' in the Tags(1) tab in Preferences, making sure it is of type "Length"
2. Create a new virtual tag
called "Time ms" and add the above formula. In the Main Player 'Tracks' view, the results can be verified by adding a new column for the 'Time ms' tag. A track that is 6:15 long gives the value 375000, which is correct.
2. Install the Additional Tagging and Reporting Tools
3. Select the track(s) you want to add the tag to. Right-click and go to Additional Tagging Tools > Copy Tag...
4. Set 'Copy tag Time ms
to tag Length
', and check that the New Tag Value in the preview window contains the track length in milliseconds.
5. Click 'Proceed'. The new Length tag is now written to the ID3 TLEN field.
You can verify that the process has worked by right-clicking a track, then going to Edit>Tag Inspector and finding the TLEN tag code.