Is there an "easy" way to extract the Title of an HTML document rather than opening the file and finding the <TITLE> </TITLE> tags? Reading the file would be easy but, I am hoping there is an API ...
These are files that are stored locally. I was hoping there was a "GetDocumentTitle" API rather than writing the function. It would be easy to do but I would prefer an API...
As far as I know there is not an API to do what you want, but as for creating a function. Your right, it would not be hard. I have created one in the past that among other things returned the title.
I have tested it on a couple of files and it works as long as there is the "<TITLE></TITLE>" tags within. I would add a check to see if the "<TITLE>" tags exists and if not then automatically return an empty string and I don't know if its a type-o or a bad cut and paste but in your error handler on your msgbox line you have "r.HelpFile", shouldn't it be Err.HelpFile?
Thanks for the tip, I didn't test it without the Tags but, I did with a blank TITLE which, for some reason, returns the file path. I will have to look into that further tonight. The "r.HelpFile" isn't a typo. "r" is a instance of my Registry object, "HelpFile" is a property which returns or sets the path to the compiled Helpfile.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.