VBScript invoking the Word 2000 Application 
Author Message
 VBScript invoking the Word 2000 Application

I'm writing a *.asp file using VBScript and gets this error:

**********************************************************
Microsoft VBScript compilation error '800a0414'

Cannot use parentheses when calling a Sub

/ietesting.asp, line 55
***********************************************************

Since I'm calling the COM component of Word 2000, I must send the
"var1.ActiveDocuments.SaveAS" call with parameters to tell the object in
which case it shall save the file (ex. txt, csv, doc etc.)

Any help for how to go around this problem with parentheses inside Sub and
Functions would be very nice.

Below you can see some of the code i've used:

<HTML>
<BODY>
<SCRIPT Language=VBScript>

Sub test
Dim var1
Dim strLocation
Dim strLocation2
    StrLocation = "ftp://filepath/filname.ext"
    StrLocation2 = "ftp://filepath/filname2.ext"

    Set var1 = CreateObject("Word.Application")
    var1.Documents.Open strLocation
    var1.ActiveDocuments.SaveAS(StrLocation2,False,False)
    var1.Documents.Close
    var1.Quit
End Sub

</SCRIPT>
</BODY>
</HTML>

Regards,

Lars Amlie



Sun, 08 Dec 2002 03:00:00 GMT  
 VBScript invoking the Word 2000 Application
Just remove the parentheses:

var1.ActiveDocuments.SaveAS StrLocation2,False,False

steve



Quote:
> I'm writing a *.asp file using VBScript and gets this error:

> **********************************************************
> Microsoft VBScript compilation error '800a0414'

> Cannot use parentheses when calling a Sub

> /ietesting.asp, line 55
> ***********************************************************

> Since I'm calling the COM component of Word 2000, I must send the
> "var1.ActiveDocuments.SaveAS" call with parameters to tell the object in
> which case it shall save the file (ex. txt, csv, doc etc.)

> Any help for how to go around this problem with parentheses inside Sub and
> Functions would be very nice.

> Below you can see some of the code i've used:

> <HTML>
> <BODY>
> <SCRIPT Language=VBScript>

> Sub test
> Dim var1
> Dim strLocation
> Dim strLocation2
>     StrLocation = "ftp://filepath/filname.ext"
>     StrLocation2 = "ftp://filepath/filname2.ext"

>     Set var1 = CreateObject("Word.Application")
>     var1.Documents.Open strLocation
>     var1.ActiveDocuments.SaveAS(StrLocation2,False,False)
>     var1.Documents.Close
>     var1.Quit
> End Sub

> </SCRIPT>
> </BODY>
> </HTML>

> Regards,

> Lars Amlie



Sun, 08 Dec 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. invoking Word 2000 from a Java application

2. Creating a Word.Application object using Word 2000

3. JSCRIPT to invoke Word.Application

4. JScript to invoke Word.Application

5. Invoking Word.Application Object using different Office versions

6. invoke a windows application from VBScript

7. invoke a windows application from VBScript

8. Invoking desktop applications from IE using VBScript

9. CreateObject: Word97 vs Word 2000.Application

10. Invoke the "Users, Computers or Groups"-dialog used in Windows 2000

11. Access 2000 & Word 2000

12. Outlook 2000 to Word 2000 document merge problem

 

 
Powered by phpBB® Forum Software