
Originally Posted by
James Reynolds
Ok and Thanks jpbro, but I tested with ChatGPT and there has been no way to make it work
There is a way to make it work. Take your original ChatGPT code, put Option Explicit at the top and try running it. It won't work because there are missing bits (SendMessage and other API declarations, RECT definition, EM_FORMATRANGE constant, etc...). Add all the missing bits as necessary, until it runs. Once it will run, change the GetRichTextHeight = result line to:
Code:
GetRichTextHeight = IIf(fr.rc.Bottom = &H7FFFFFFF, 0, fr.rc.Bottom)
And GetRichTextHeight will now return the height of the RTF content (including images and whatever else might be there).