Cannot execute cut-n-paste VBScripts
Posted
by IcedDante
on Stack Overflow
See other posts from Stack Overflow
or by IcedDante
Published on 2010-03-12T17:17:15Z
Indexed on
2010/03/12
18:47 UTC
Read the original article
Hit count: 248
I have been going mad trying to figure out why my scripts weren't working, until I started copying and pasting sample source code directly from a few websites only to have it fail there as well. I am getting the following error in my VBScripts:
C:\temp\vbs\script.vbs(19, 53) Microsoft VBScript compilation error: Expected statement'
For a line of code that looks like this:
wdoc.Application.Selection.Find.Execute Replace:=wdReplaceAll
This is interfacing with Microsft Word in Office 2007 to conduct a search and replace. Index 53 point directly to the := part of the assignment. Since this type of syntax doesn't work on my machine and I am using it from several websites, I was wondering if the cscript.exe I use is out of date.
Am I not calling cscript properly?
© Stack Overflow or respective owner