When you put the code into a place other than word, you must change the syntax to reflect the new home in which it finds itself.
For instance, in Word Selection.Font works. But in another location, you would need to refer to the Word instance, and the document WordApp.MyDoc.Selection.Font.
If you have another VBA application (Excel, Access, ...) or
VB (which would be best), you should develop your code there, giving you intellisense in some cases, and access to the WatchWindow to examine your various objects.
Then take the result of that development, and adapt it to your .asp page(s).
Brian
Love the Creator because of the creation.