I'm having a problem finding the correct syntax for automating word through vbscript. I've managed to open the file but can't discover how to write to it. Any help would be appreciated. Any place I can find these syntaxes?
how about recording a macro in Word itself and adding some text to a word document. You can then look at the VB code with the Visual Basic Editor that is built into word.
I used this method to figure out the code for automating word and opening a document. Tony
Have already tried this. I get this code in the macro that's produced
Selection.TypeText Text:="Test string"
but when I apply it the my HTML code I get an error. This is the code so far:
<SCRIPT language=VBScript>
<!--
Option Explicit
Sub cmdButton_OnClick()
Dim Word
Set Word = CreateObject("Word.Application"
Word.Visible = TRUE
Word.Documents.open ("Q:/TestFile.dot"
End Sub
-->
</SCRIPT>
Q is the drive letter of my web site. I use the actual URL but have replaced for this example.
Thanks for the help. I actually needed to append character to the 2nd word, a #, of the document using a the contents of a asp variable. Pretty much the same code as above except for
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.