Doctype is the declaration above the html start tag.

It is also called Document Type Definition and DTD.

The following code will extract it from the ActiveDocument.

The commands below will set the DocType of the ActiveDocument.  It will be placed at the very top of the document, above the first html element.

strHTML = "<!DOCTYPE HTML PUBLIC " & """" & _
"-//W3C//DTD HTML 4.01 Transitional//EN" & _
"""" & " " & """" & _
"http://www.w3.org/TR/html4/loose.dtd" & """" & ">"

ActiveDocument.all.tags("html"). _
Item(0).insertAdjacentHTML _
"BeforeBegin", strHTML				

Output

<!DOCTYPE HTML PUBLIC 
"-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>						

 

 

 

Valid XHTML 1.0 Transitional        Valid CSS!