that has gone long enough. Please try to read the code before answering any questions about the code posted which clearly says.
doc := Browser.ComServer.Document as IHTMLDocument2;
that line should be clear to any one, that the application is not, and it should never be, the creator of the document, the browser activex control is though.
To OP, please upload the zip file somewhere else like google drive or some other free file service and post a link here if you do not want to get involved with the silliness of google, microsoft and all their "security processes" use one of the less used versioning sites (github, gitlab etc) to create a project and upload your zip there.